/** * Reset controller state. */ resetState() { this.playbackTimer.reset(); this.replayDetectionTimer.reset(); if (this.currentSong !== null) { this.clearNowPlayingNotification(); } this.currentSong = null; }
/** * Make the controller to ignore current song. */ skipCurrentSong() { if (!this.currentSong) { return; } this.pageAction.setSongSkipped(this.currentSong); this.currentSong.flags.isSkipped = true; this.playbackTimer.reset(); this.replayDetectionTimer.reset(); this.clearNowPlayingNotification(); }
/** Public functions */ /** * Switch the state of controller. * @param {Boolean} flag True means enabled and vice versa */ setEnabled(flag) { this.isEnabled = flag; if (flag) { this.pageAction.setSiteSupported(); } else { this.pageAction.setSiteDisabled(); } if (!flag && this.currentSong) { this.playbackTimer.reset(); this.replayDetectionTimer.reset(); this.clearNowPlayingNotification(); } }