HTML and CSS Reference
In-Depth Information
break out of the method. This prevents the instance variable from being set by
the invalid value.
Also, for convenience, the app.utility.validator object has been assigned to
the validator variable. This makes it a little bit easier to access validation
methods, rather than having to constantly type out the extremely long
namespace. Because it's an instance variable, it's also accessible to privileged
methods.
app.model.videosource = function appModelVideoSource(url, format){
/**
* The video source's instance variables
*/
var _url,
_format,
_self = this,
validator = app.utility.validator;
...
/**
* Sets the url of the video source
* @param {String} url
*/
this.setUrl = function(url){
// Check to see whether the value is a primitive string type
if(!validator.isTypeOf(url, "string")){
throw {
message: "The url property in the videosource model requires a
'string' type",
type: "validation_exception"
}
return;
}
_url = url;
}
...
/**
* Sets the mimetype of the video source
* @param {app.type.format} format
*/
this.setFormat = function(format){
// Check to see whether the value is an app.type.format
if(!validator.isTypeOf(format, app.type.format)){
throw {
 
Search WWH ::




Custom Search