當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript main.module.default類代碼示例

本文整理匯總了TypeScript中main.module.default的典型用法代碼示例。如果您正苦於以下問題:TypeScript module.default類的具體用法?TypeScript module.default怎麽用?TypeScript module.default使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了module.default類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

import app from 'main.module';
import {ILogger, LoggerService} from 'helpers/logger/logger';

/**
 * Displays the SPA shell.
 * The shell contains the shared parts of the application: header, footer, navigation...
 */
export class ShellController {

  private logger: ILogger;

  constructor(private $state: ng.ui.IStateService,
              logger: LoggerService) {

    this.logger = logger.getLogger('shell');
    this.logger.log('init');
  }

  /**
   * Checks if the specified name is contained in the current navigation state.
   * @param {string} name The state name to check.
   * @return {boolean} True if the specified name is contained in the current navigation state.
   */
  stateContains(name: string): boolean {
    return _.startsWith(this.$state.current.name, name);
  }

}

app.controller('shellController', ShellController);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:30,代碼來源:shell.controller.ts

示例2:

  $provide.decorator('$log', ($delegate: any) => {
    if (!env.debug) {
      $delegate.log = angular.noop;
      $delegate.debug = angular.noop;
    }
    return $delegate;
  });

  // Disable angular debug info in production version
  $compileProvider.debugInfoEnabled(env.debug);

  $analyticsProvider.developerMode(env.debug);
  $analyticsProvider.firstPageview(true);

  // Set Soundcloud client ID
  plangularConfigProvider.clientId = config.soundCloudClientId;

  // Customize markdown compilation
  markedProvider.setRenderer({
    link: (href, title, text) => {
      let isExternal = href.indexOf('http') === 0;
      return '<a ' + (isExternal ? 'ng-click="vm.open(\'' + href + '\')"' : 'href="' + href + '"') +
        (title ? ' title="' + title + '"' : '') + '>' + text + '</a>';
    }
  });

}

app.config(mainConfig);

開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:29,代碼來源:main.config.ts

示例3: Logger

export class LoggerService {

  constructor(private $log: ng.ILogService) {}

  /**
   * Gets a customized logger based on the given module name.
   * @param {string} moduleName The module name.
   * @return {Logger} A logger object.
   */
  getLogger(moduleName: string): ILogger {
    return new Logger(this.$log, moduleName, log);
  }

  /**
   * Adds a new observer function that will be called for each new log entry.
   * These parameters are passed to the observer function, in order:
   * - message {string} message The message to be logged.
   * - source {?string=} source The source of the log.
   * - level {'log'|'info'|'warning'|'error'} level The log level.
   * - options {Object?} options Additional log options.
   * @param {!function} observerFunc The observer function.
   */
  addObserver(observerFunc: IObserverFunction) {
    observers.push(observerFunc);
  }

}

app.service('logger', LoggerService);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:29,代碼來源:logger.ts

示例4: constructor

import app from 'main.module';
import {ILogger, LoggerService} from 'helpers/logger/logger';

export class InfosController {

  private logger: ILogger;

  constructor(logger: LoggerService) {
    this.logger = logger.getLogger('infosController');
    this.logger.log('init');
  }

}

app.controller('infosController', InfosController);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:15,代碼來源:infos.controller.ts

示例5: getId

                  scene: set.scene.name
                }),
                data: Set.getSerializableCopyWithId(set),
                at: setNotificationDate.toDate(),
              });

            }
          });
        });

      });
  }

  private getId() {
    let id = this.id++;
    this.$window.localStorage.setItem(NOTIFICATION_KEY, '' + this.id);
    return id;
  }

  private onTrigger(event: any, notification: any) {
    this.logger.log('notification triggered');

    if (this.$rootScope['foreground']) {
      this.toastService.show(notification.text);
    }
  }

}

app.service('notificationService', NotificationService);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:30,代碼來源:notification.service.ts

示例6:

import app from 'main.module';

/**
 * Wraps external global libraries into AngularJS injection system.
 * global window: false
 */
app
  .constant('_', _) // Lodash
  .constant('moment', moment);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:9,代碼來源:main.wrappers.ts

示例7: encodeURIComponent

    this.logger.log('Injecting context in: ' + restApi);

    if (!context) {
      throw 'inject: context must be defined';
    }

    // Search for context properties to inject
    let properties = restApi.match(/(:\w+)/g);

    angular.forEach(properties, (property: string) => {
      let contextVar = property.substring(1);
      let contextValue = context[contextVar];

      if (contextValue !== undefined) {
        contextValue = encodeURIComponent(contextValue);
        restApi = restApi.replace(property, contextValue);
        this.logger.log('Injected ' + contextValue + ' for ' + property);
      } else {
        throw 'inject: context.' + contextVar + ' expected but undefined';
      }
    });

    this.logger.log('Resulting REST API: ' + restApi);

    return restApi;
  }

}

app.service('contextService', ContextService);
開發者ID:angular-starter-kit,項目名稱:generator-angular-pro,代碼行數:30,代碼來源:context.service.ts

示例8: resetNavBar

      });
    }
    for (let i = 0; i < this.titles.length; ++i) {
      let title = angular.element(this.titles[i]);
      title.css({
        color: 'rgba(255,255,255,0)'
      });
    }
  }

  resetNavBar() {
    for (let i = 0; i < this.navbars.length; ++i) {
      let header = angular.element(this.navbars[i]);
      header.css({
        borderColor: '',
        backgroundImage: '',
        backgroundColor: ''
      });
    }
    for (let i = 0; i < this.titles.length; ++i) {
      let title = angular.element(this.titles[i]);
      title.css({
        color: ''
      });
    }
  }

}

app.service('fadingBarService', FadingBarService);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:30,代碼來源:fading-bar.service.ts

示例9: init

  /**
   * Initializes the root controller.
   */
  function init() {
    // Enable debug mode for translations
    gettextCatalog.debugPrefix = 'T_';
    gettextCatalog.debug = config.environment.debug;

    vm.setLanguage();

    // Set REST server configuration
    restService.setServer(config.environment.server);
  }

  /**
   * Updates the title.
   * @param {?string=} stateTitle Title of current state, to be translated.
   */
  function updateTitle(stateTitle?: string) {
    vm.pageTitle = gettextCatalog.getString('APP_NAME');

    if (stateTitle) {
      vm.pageTitle += ' | ' + gettextCatalog.getString(stateTitle);
    }
  }

}

app.run(main);
開發者ID:sinedied,項目名稱:festival-editor,代碼行數:29,代碼來源:main.run.ts

示例10: fixXScrollWithHandle

  fixXScrollWithHandle(handle: string) {
    this.$timeout(() => {
      let scrollView = this.$ionicScrollDelegate.$getByHandle(handle).getScrollView();
      let container = scrollView.__container;

      if (!container.__scrollFixed) {
        container.__scrollFixed = true;

        // Replace original touch handler to allow bubbling up
        let originalTouchStart = scrollView.touchStart;
        container.removeEventListener('touchstart', scrollView.touchStart);

        scrollView.touchStart = (e) => {
          // Fake this method to prevent ionic touch hander to stop bubbling up
          e.preventDefault = angular.noop;

          // For some reasons, this check is needed to avoid an error...
          if (originalTouchStart) {
            originalTouchStart.apply(scrollView, [e]);
          }
        };

        container.addEventListener('touchstart', scrollView.touchStart, false);
      }
    });
  }

}

app.service('scrollService', ScrollService);
開發者ID:sinedied,項目名稱:hadra-trance-festival,代碼行數:30,代碼來源:scroll.service.ts


注:本文中的main.module.default類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。