本文整理匯總了TypeScript中@providers/logger.CoreLoggerProvider.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CoreLoggerProvider.getInstance方法的具體用法?TypeScript CoreLoggerProvider.getInstance怎麽用?TypeScript CoreLoggerProvider.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@providers/logger.CoreLoggerProvider
的用法示例。
在下文中一共展示了CoreLoggerProvider.getInstance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(platform: Platform, pushNotificationsProvider: AddonPushNotificationsProvider, eventsProvider: CoreEventsProvider,
localNotificationsProvider: CoreLocalNotificationsProvider, loggerProvider: CoreLoggerProvider,
updateManager: CoreUpdateManagerProvider, cronDelegate: CoreCronDelegate,
registerCronHandler: AddonPushNotificationsRegisterCronHandler,
unregisterCronHandler: AddonPushNotificationsUnregisterCronHandler) {
const logger = loggerProvider.getInstance('AddonPushNotificationsModule');
// Register the handlers.
cronDelegate.register(registerCronHandler);
cronDelegate.register(unregisterCronHandler);
// Register device on GCM or APNS server.
platform.ready().then(() => {
pushNotificationsProvider.registerDevice();
});
eventsProvider.on(CoreEventsProvider.NOTIFICATION_SOUND_CHANGED, () => {
// Notification sound has changed, register the device again to update the sound setting.
pushNotificationsProvider.registerDevice();
});
// Register device on Moodle site when login.
eventsProvider.on(CoreEventsProvider.LOGIN, () => {
pushNotificationsProvider.registerDeviceOnMoodle().catch((error) => {
logger.warn('Can\'t register device', error);
});
});
eventsProvider.on(CoreEventsProvider.SITE_DELETED, (site) => {
pushNotificationsProvider.unregisterDeviceOnMoodle(site).catch((error) => {
logger.warn('Can\'t unregister device', error);
});
pushNotificationsProvider.cleanSiteCounters(site.id);
});
// Listen for local notification clicks (generated by the app).
localNotificationsProvider.registerClick(AddonPushNotificationsProvider.COMPONENT,
pushNotificationsProvider.notificationClicked.bind(pushNotificationsProvider));
// Allow migrating the table from the old app to the new schema.
updateManager.registerAppTableMigration({
name: 'mma_pushnotifications_badge',
newName: AddonPushNotificationsProvider.BADGE_TABLE,
fields: [
{
name: 'siteid',
newName: 'siteId'
}
]
});
// Migrate the component name.
updateManager.registerLocalNotifComponentMigration('mmaPushNotifications', AddonPushNotificationsProvider.COMPONENT);
}
示例2: constructor
constructor(initDelegate: CoreInitDelegate, remoteThemesProvider: AddonRemoteThemesProvider, eventsProvider: CoreEventsProvider,
sitesProvider: CoreSitesProvider, loggerProvider: CoreLoggerProvider) {
const logger = loggerProvider.getInstance('AddonRemoteThemesModule');
// Preload the current site styles.
initDelegate.registerProcess({
name: 'AddonRemoteThemesPreloadCurrent',
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 250,
blocking: true,
load: remoteThemesProvider.preloadCurrentSite.bind(remoteThemesProvider)
});
// Preload the styles of the rest of sites.
initDelegate.registerProcess({
name: 'AddonRemoteThemesPreload',
blocking: true,
load: remoteThemesProvider.preloadSites.bind(remoteThemesProvider)
});
let addingSite;
// When a new site is added to the app, add its styles.
eventsProvider.on(CoreEventsProvider.SITE_ADDED, (data) => {
addingSite = data.siteId;
remoteThemesProvider.addSite(data.siteId).catch((error) => {
logger.error('Error adding site', error);
}).then(() => {
if (addingSite == data.siteId) {
addingSite = false;
}
// User has logged in, remove tmp styles and enable loaded styles.
if (data.siteId == sitesProvider.getCurrentSiteId()) {
remoteThemesProvider.unloadTmpStyles();
remoteThemesProvider.enable(data.siteId);
}
});
});
// Update styles when current site is updated.
eventsProvider.on(CoreEventsProvider.SITE_UPDATED, (data) => {
if (data.siteId === sitesProvider.getCurrentSiteId()) {
remoteThemesProvider.load(data.siteId).catch((error) => {
logger.error('Error loading site after site update', error);
});
}
});
// Enable styles of current site on login.
eventsProvider.on(CoreEventsProvider.LOGIN, (data) => {
remoteThemesProvider.unloadTmpStyles();
remoteThemesProvider.enable(data.siteId);
});
// Disable added styles on logout.
eventsProvider.on(CoreEventsProvider.LOGOUT, (data) => {
remoteThemesProvider.clear();
});
// Remove site styles when a site is deleted.
eventsProvider.on(CoreEventsProvider.SITE_DELETED, (site) => {
remoteThemesProvider.removeSite(site.id);
});
// Load temporary styles when site config is checked in login.
eventsProvider.on(CoreEventsProvider.LOGIN_SITE_CHECKED, (data) => {
remoteThemesProvider.loadTmpStyles(data.config.mobilecssurl).catch((error) => {
logger.error('Error loading tmp styles', error);
});
});
// Unload temporary styles when site config is "unchecked" in login.
eventsProvider.on(CoreEventsProvider.LOGIN_SITE_UNCHECKED, (data) => {
if (data.siteId && data.siteId === addingSite) {
// The tmp styles are from a site that is being added permanently.
// Wait for the final site styles to be loaded before removing the tmp styles so there is no blink effect.
} else {
// The tmp styles are from a site that wasn't added in the end. Just remove them.
remoteThemesProvider.unloadTmpStyles();
}
});
}
示例3: constructor
constructor(navParams: NavParams, private viewCtrl: ViewController, logger: CoreLoggerProvider) {
this.title = navParams.get('title');
this.items = navParams.get('items') || [];
this.uniqueId = navParams.get('id');
this.logger = logger.getInstance('CoreContextMenuPopoverComponent');
}