当前位置: 首页>>代码示例>>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;未经允许,请勿转载。