本文整理汇总了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);
}
}
示例2: sendLogoutEvent
sendLogoutEvent() {
console.log("Publishing logout event");
this.events.publish(_USER_LOGOUT_EVENT);
}
示例3: sendLoggedInEvent
sendLoggedInEvent() {
console.log("Publishing login event");
this.events.publish(_USER_LOGIN_EVENT);
}
示例4:
(doseSeries: DoseSeries) => {
this.events.publish(
"doseSeries:deleted",
doseSeries as DoseSeries
);
}
示例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;
}
示例6:
this.media.addEventListener('ended', () => this.events.publish(Utils.EVENT_MEDIA_END,this.currentSound));