当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript logger.CoreLoggerProvider类代码示例

本文整理汇总了TypeScript中@providers/logger.CoreLoggerProvider的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreLoggerProvider类的具体用法?TypeScript CoreLoggerProvider怎么用?TypeScript CoreLoggerProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CoreLoggerProvider类的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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。