Namespace MBX.JsView
Defined in: js_view.js.
Constructor Attributes | Constructor Name and Description |
---|---|
this is the view part of the MVC framework
handle updates and creations and deletes of registered
objects and classes
|
Method Attributes | Method Name and Description |
---|---|
<static> |
MBX.JsView.assignInstance()
attach a JsModel#instance to this DOM element
Preferred method of accessing this function is through extended elements
|
<static> |
MBX.JsView.create(opts)
create a new view handler.
|
<static> |
MBX.JsView.cssForInstance(instance, prePend)
given an instance of a model, give the recommended instance class
|
<static> |
MBX.JsView.extend(methsAndAttrs)
call extend() to add methods and/or attributes to ALL views
|
<static> |
MBX.JsView.getInstance()
fetch a JsModel#instance from this DOM element
Preferred method of accessing this function is through extended elements
|
<static> |
MBX.JsView.modelCSS(model, prePend)
Grab give a model - get a css.
|
<static> |
MBX.JsView.stopUpdating(element)
stop updating this instance, all event handlers are removed
Preferred method of accessing this function is through extended elements
|
<static> |
MBX.JsView.updatesOn(obj, key, opts)
Added to prototype elements when a view is created
allows you to observe particular keys of a model object
|
Namespace Detail
MBX.JsView
this is the view part of the MVC framework
handle updates and creations and deletes of registered
objects and classes
Method Detail
<static>
MBX.JsView.assignInstance()
attach a JsModel#instance to this DOM element
Preferred method of accessing this function is through extended elements
$("el").assignInstance(instance); $("el").getInstance(); // == instance
<static>
MBX.JsView.create(opts)
create a new view handler... specify a model and some
functions and some great magic happens.
If your view listens to a model, but you are not dependent on real-time updates,
you can add the option "looselyCoupled: true" and all updates will be done with
setTimeout, which will be a performance enhancement.
MBX.JsView.create({ model: MBX.DesktopUpload, looselyCoupled: false, // false is the default onCreate: function (upload) { //create the upload }, onChange: function (upload) { // any upload changes }, onDestroy: function (upload) { // handle destroys } });
- Parameters:
- {Object} opts
- the various options specified for a view
<static>
{String}
MBX.JsView.cssForInstance(instance, prePend)
given an instance of a model, give the recommended instance class
- Parameters:
- {JsModel#instance} instance
- the JsModel instance
- {String} prePend
- any string you want prepended to the return (to avoid "." + MBX.JsView.modelCSS(model))
- Returns:
- {String} a long-ish css class for a specific instance
<static>
MBX.JsView.extend(methsAndAttrs)
call extend() to add methods and/or attributes to ALL views
- Parameters:
- {Object} methsAndAttrs
<static>
MBX.JsView.getInstance()
fetch a JsModel#instance from this DOM element
Preferred method of accessing this function is through extended elements
$("el").assignInstance(instance); $("el").getInstance(); // == instance
<static>
{String}
MBX.JsView.modelCSS(model, prePend)
Grab give a model - get a css... pass in "." as the second arg to give it css-style return
- Parameters:
- {JsModel} model
- the model you want the css for
- {String} prePend
- any string you want prepended to the return (to avoid "." + MBX.JsView.modelCSS(model))
- Returns:
- {String} a css class for a model
<static>
{DOM Element}
MBX.JsView.stopUpdating(element)
stop updating this instance, all event handlers are removed
Preferred method of accessing this function is through extended elements
$("el").stopUpdating();
- Parameters:
- {DOM Element} element
- the element to stop observing - this will usually be filled for you by prototype
- Returns:
- {DOM Element} element for chaining
<static>
{DOM element}
MBX.JsView.updatesOn(obj, key, opts)
Added to prototype elements when a view is created
allows you to observe particular keys of a model object
- Parameters:
- {JsModel#instance} obj
- the model instance to watch
- {String} key
- the key to watch
- {Object} opts
- handler or preProcess functions to execute
- Returns:
- {DOM element} the dom element that was called (for chaining)