HTML and CSS Reference
In-Depth Information
* added to the object
*/
for(var i = 0; i < sources.length; i++){
_self.addSource(sources[i]);
}
}
/**
* Gets the source at a specific index
* @param {Integer} index
* @return {app.model.videosource} source
*/
this.getSource = function(index){
return _sources[index];
}
/**
* Removes a source at a specific index
* @param {Integer} index
*/
this.removeSource = function(index){
_sources.splice(index, 1);
}
/**
* Adds a source to the sources array
* @param {app.model.videosource} source
*/
this.addSource = function(source){
_sources.push(source);
}
this.init();
}
With the Video model complete, you can move onto the last small model, the
Actor model.
The Actor Model
The Actor model is another simple object, which contains only the actor's name
and role within the Movie . Create a new file within js/app/models/ called
actor.js . There's not much to explain here, so go ahead and create the model.
It should have two instance variables called _name and _role that are set through
the constructor. Your complete code will look like the following.
 
Search WWH ::




Custom Search