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


TypeScript index.Events類代碼示例

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


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

示例1: play

    play(newSound:any):void {
        console.log('Start sound',newSound);

        let soundPlaying:boolean = this.isPlaying() && this.isCurrentSound(newSound);

        if(!soundPlaying) {
            if (this.media && !this.media.paused) {
                this.stop();
            }
            this.currentSound = newSound;

            if (this.platform.is('cordova')) {
                console.log('cordova');
                if (!this.cacheService.soundInCache(newSound.file)) {
                    this.media.src = newSound.file;
                } else {
                    console.log('Playing sound from cache', this.cacheService.getCachedSoundPath(newSound));
                    this.media.src = this.cacheService.getCachedSoundPath(newSound);
                }
            } else {
                if (!this.cacheService.soundInCache(newSound.file)) {
                    this.media.src = newSound.file;
                } else {
                    console.log('Playing sound from cache', this.cacheService.soundCache.toInternalURL(newSound.file));
                    this.media.src = this.cacheService.soundCache.toInternalURL(newSound.file);
                }
            }

            this.media.load();
            this.media.play();

            this.lastSound = newSound;
        } else {
            console.log('This song is playing already');
            this.currentSound.loading = false;
            this.currentSound.playing = true;
            this.events.publish(Utils.EVENT_MEDIA_PLAYING,this.currentSound);
        }
    }
開發者ID:michaeldesigaud,項目名稱:palmashow-app,代碼行數:39,代碼來源:media.service.ts

示例2: sendLogoutEvent

 sendLogoutEvent() {
   console.log("Publishing logout event");
   this.events.publish(_USER_LOGOUT_EVENT);
 }
開發者ID:r-matsumura,項目名稱:poc-candidate-stores,代碼行數:4,代碼來源:events.service.ts

示例3: sendLoggedInEvent

 sendLoggedInEvent() {
   console.log("Publishing login event");
   this.events.publish(_USER_LOGIN_EVENT);
 }
開發者ID:r-matsumura,項目名稱:poc-candidate-stores,代碼行數:4,代碼來源:events.service.ts

示例4:

 (doseSeries: DoseSeries) => {
     this.events.publish(
         "doseSeries:deleted",
         doseSeries as DoseSeries
     );
 }
開發者ID:dose-amigos,項目名稱:dose-amigos-ionic,代碼行數:6,代碼來源:dose-series-slider.component.ts

示例5: stop

 stop():void {
     this.events.publish('media:end',this.lastSound);
     this.media.pause();
     console.log('Stop current media',this.media);
     this.media.currentTime = 0;
 }
開發者ID:michaeldesigaud,項目名稱:palmashow-app,代碼行數:6,代碼來源:media.service.ts

示例6:

this.media.addEventListener('ended', () => this.events.publish(Utils.EVENT_MEDIA_END,this.currentSound));
開發者ID:michaeldesigaud,項目名稱:palmashow-app,代碼行數:1,代碼來源:media.service.ts


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