-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add _interface_ IStupidPlayer * Refactor stupid-player using es6 syntax * Fix editorconfig * Fix IStupidPlayer for node.js * Fix {I, }StupidPlayer for node.js v4, v5 * Use arrow function in class. Move hooks from stupid-player-old * Remove set/get, add methods * Bind context on hooks. * Move code blocks
- Loading branch information
1 parent
22eb9d9
commit ec901eb
Showing
3 changed files
with
370 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
const events = require('events'); | ||
|
||
|
||
|
||
/** | ||
* @interface | ||
*/ | ||
module.exports = (function() { | ||
'use strict'; | ||
return class IStupidPlayer extends events.EventEmitter { | ||
constructor() { | ||
super(); | ||
|
||
/** | ||
* @const {string} | ||
*/ | ||
this.EVENT_PLAY = 'play'; | ||
|
||
/** | ||
* @const {string} | ||
*/ | ||
this.EVENT_STOP = 'stop'; | ||
|
||
/** | ||
* Fired with: {number} volume | ||
* @const {string} | ||
*/ | ||
this.EVENT_VOLUME_CHANGE = 'volume-change'; | ||
|
||
/** | ||
* Fired with: string | ||
* @const {string} | ||
*/ | ||
this.EVENT_ERROR = 'error'; | ||
} | ||
|
||
/** | ||
* @param {string} url | ||
* @return {Promise<undefined>} | ||
*/ | ||
play(url) { | ||
throw 'IStupidPlayer.play not implemented'; | ||
} | ||
|
||
/** | ||
* @return {Promise<undefined>} | ||
*/ | ||
pause() { | ||
throw 'IStupidPlayer.pause not implemented'; | ||
} | ||
|
||
/** | ||
* @return {Promise<undefined>} | ||
*/ | ||
stop() { | ||
throw 'IStupidPlayer.stop not implemented'; | ||
} | ||
|
||
/** | ||
* @return {number} 0..100 | ||
*/ | ||
getVolume() { | ||
throw 'IStupidPlayer.[[Get]]volume not implemented'; | ||
} | ||
|
||
/** | ||
* @param {number} value 0..100 | ||
*/ | ||
setVolume(value) { | ||
throw 'IStupidPlayer.[[Set]]volume not implemented'; | ||
} | ||
|
||
/** | ||
* @return {IStupidPlayer.State} | ||
*/ | ||
get state() { | ||
throw 'IStupidPlayer.[[Get]]state not implemented'; | ||
} | ||
|
||
/** | ||
* @enum {string} | ||
*/ | ||
static get State() { | ||
return { | ||
PAUSE: 'pause', | ||
PLAY: 'play', | ||
STOP: 'stop' | ||
}; | ||
} | ||
}; | ||
})(); |
Oops, something went wrong.