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


TypeScript CoreLoggerProvider.getInstance方法代碼示例

本文整理匯總了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);
    }
開發者ID:santosleonardo,項目名稱:moodlemobile2,代碼行數:55,代碼來源:pushnotifications.module.ts

示例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();
            }
        });
    }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:84,代碼來源:remotethemes.module.ts

示例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');
 }
開發者ID:santosleonardo,項目名稱:moodlemobile2,代碼行數:6,代碼來源:context-menu-popover.ts


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