HTML and CSS Reference
In-Depth Information
this.getState = function(){
return state;
The getters in this example will simply return the private variable; however, you
may define a getter, such as getCurrentTimeInSeconds , that will modify the
return value so that the function returns the playback time in seconds. For
this.getCurrentTimeInSeconds = function(){
return (currentTime / 1000);
Next, you must define the controls for the track, such as play, pause, and stop.
app.track = function(length){
this.stop = function(){
state = _self.state.STOPPED;
}; = function(){
if(state != _self.state.PLAYING){
interval = window.setInterval(updateTime, updateInterval);
state = _self.state.PLAYING;;
this.pause = function(){
state = _self.state.PAUSED;;
this.stop will stop the track and clear the interval timer using
window.clearInterval(interval) . The stop method will also set the current
state of the track to 0 or STOPPED using state = _self.state.STOPPED . This
method will also reset the current time and make a call to the didStop callback
Search WWH ::

Custom Search