本文整理匯總了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));