parent
4b5c1cdbda
commit
318bd677f0
14 changed files with 38 additions and 47 deletions
@ -0,0 +1,4 @@ |
||||
export default function asJson(s: Object | string) { |
||||
return (typeof s === 'string') ? |
||||
JSON.parse(s) : s; |
||||
} |
@ -1,24 +0,0 @@ |
||||
function Player() { |
||||
} |
||||
Player.prototype.play = function(song) { |
||||
this.currentlyPlayingSong = song; |
||||
this.isPlaying = true; |
||||
}; |
||||
|
||||
Player.prototype.pause = function() { |
||||
this.isPlaying = false; |
||||
}; |
||||
|
||||
Player.prototype.resume = function() { |
||||
if (this.isPlaying) { |
||||
throw new Error("song is already playing"); |
||||
} |
||||
|
||||
this.isPlaying = true; |
||||
}; |
||||
|
||||
Player.prototype.makeFavorite = function() { |
||||
this.currentlyPlayingSong.persistFavoriteStatus(true); |
||||
}; |
||||
|
||||
module.exports = Player; |
@ -1,9 +0,0 @@ |
||||
function Song() { |
||||
} |
||||
|
||||
Song.prototype.persistFavoriteStatus = function(value) { |
||||
// something complicated
|
||||
throw new Error("not yet implemented"); |
||||
}; |
||||
|
||||
module.exports = Song; |
Loading…
Reference in new issue