本文整理汇总了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);
示例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);
示例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);
示例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);
示例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);
示例6:
import app from 'main.module';
/**
* Wraps external global libraries into AngularJS injection system.
* global window: false
*/
app
.constant('_', _) // Lodash
.constant('moment', moment);
示例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);
示例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);
示例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);
示例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);