HTML and CSS Reference
In-Depth Information
app.model.video = function appModelVideo(title, length, posterframe){
/**
* The video's instance variables
*/
var _title,
_length,
_posterframe,
_sources = [],
self = this;
}
You can create accessors for the _sources instance variable. As it isn't
imperative toward the function of the object's immediate instance, it doesn't
need to be in the constructor.
The accessors for the _sources instance variable consists of a method to add
single source instances, remove and get instances from the array based on an
index, retrieve the full array, or overwrite the array with a new array. The
accessors can be seen in the following code snippet.
app.model.video = function appModelVideo(title, length, posterframe){
...
/**
* Gets all of the video sources used for embedding video
* in POSH
* @return {Array}
*/
this.getSources = function(){
return _sources;
}
/**
* Sets all video sources using an array
* @param {Array} sources
*/
this.setSources = function(sources){
/**
* Clears the sources array
*/
__sources.length = 0;
/**
* Rather than setting the sources all in one go,
* you use the addSource method, which can handle
* any validation for each source before it's
* added to the object
 
Search WWH ::




Custom Search