Class rio.Attr
Attr is the basis for most of rio. It is the class from which all apps, pages, models, and components
are derived, though you will rarely have to use Attr directly. Attr provides all of the functionality
related to attributes, bindings, dependency management, and events.
Defined in: attr.js.
Constructor Attributes | Constructor Name and Description |
---|---|
rio.Attr()
|
Method Attributes | Method Name and Description |
---|---|
bind(attribute, binding, skipInitialExecution, overrideInitialOldValue)
Binds a function to an attribute.
|
|
binding(attribute)
Returns a binding to the specified attribute or attribute path
NOTE: The most common reason for using binding is to specify the initial value of another attrAccessor with an attribute path. |
|
<static> |
rio.Attr.create(name, extends, args)
Creates an instance of rio.Attr.
|
<static> |
rio.Attr.extend(attr, extension)
|
fire(eventName)
Fires an event.
|
|
<static> |
rio.Attr.fireWhenReady(f)
|
freeze()
|
|
frozen()
|
|
observe(eventName, handler)
Observes an event.
|
|
setAndReturnAfterSet(fieldName, newValue, options)
|
|
stopObserving(eventName, handler)
|
|
<static> |
rio.Attr.toString()
|
<static> |
rio.Attr.transaction(t)
|
unfreeze()
|
|
updateAttributes(attributes, options)
|
|
<static> |
rio.Attr.updateAttributes(updates)
|
Method Detail
bind(attribute, binding, skipInitialExecution, overrideInitialOldValue)
Binds a function to an attribute.
NOTE: The function will be called immediately with the current value of the attribute.
NOTE: The function will be called immediately with the current value of the attribute.
attr.bind("attribute", function(newValue) { alert(newValue); });
- Parameters:
- {String} attribute
- The name of the attribute to bind
- {Function} binding
- The function to execute when the value of the attribute changes
- {Boolean} skipInitialExecution
- (optional) Do not immediately call the function with the attributes current value
- overrideInitialOldValue
binding(attribute)
Returns a binding to the specified attribute or attribute path
NOTE: The most common reason for using binding is to specify the initial value of another attrAccessor with an attribute path.
NOTE: The most common reason for using binding is to specify the initial value of another attrAccessor with an attribute path.
attr.binding("attribute");
- Parameters:
- {String} attribute
- The name of the attribute to bind
<static>
{rio.Attr}
rio.Attr.create(name, extends, args)
Creates an instance of rio.Attr.
var attr = rio.Attr.create("AttrName", { attrAccessors: [], // list of accessors attrReaders: [], // list of readers methods: { initialize: function() { } }, classMethods: { } });
- Parameters:
- {String} name
- (optional) The name of this Attr. Used primarily for testing reports.
- {Object} extends
- (optional) An Attr class to use as a superclass.
- {Object} args
- (optional) The definition of the class.
- Returns:
- a new instance of type Attr
<static>
rio.Attr.extend(attr, extension)
- Parameters:
- attr
- extension
fire(eventName)
Fires an event.
- Parameters:
- {String} eventName
- The name of the event to fire
<static>
rio.Attr.fireWhenReady(f)
- Parameters:
- f
freeze()
frozen()
observe(eventName, handler)
Observes an event.
- Parameters:
- {String} eventName
- The name of the event to observe
- {Function} handler
- A function to call when the even is fired
setAndReturnAfterSet(fieldName, newValue, options)
- Parameters:
- fieldName
- newValue
- options
stopObserving(eventName, handler)
- Parameters:
- eventName
- handler
<static>
rio.Attr.toString()
<static>
rio.Attr.transaction(t)
- Parameters:
- t
unfreeze()
updateAttributes(attributes, options)
- Parameters:
- attributes
- options
<static>
rio.Attr.updateAttributes(updates)
- Parameters:
- updates