-
Notifications
You must be signed in to change notification settings - Fork 11
Component
var someComponent = fastn('myComponent');
A fastn component is an object that represents a chunk of UI.
A component is an instance of EventEmitter, and is passed through component constructors to have features added or modified.
All component methods are overridable.
Attaches the component to the provided object.
If a Model
is passed, attach will use the object that the model is currently attached to.
If a firmness is provided, the component will only be attached if the firmness is equal to or higher than that which it is currently attached at.
Returns the component.
Detaches the component from the model it is attached to
If a firmness is provided, the component will only be detached if the firmness is equal to or higher than that which it is currently attached at.
Returns the component.
Returns a Model
which is attached to the object that the component is attached to.
Destroys a component, potentially freeing memory and removing event handlers.
Returns the component.
Returns whether the component is destroyed
If called with no arguments, will return the components current binding.
If called with a path or binding, will set the components binding.
Sets a key on the component to be the passed property.
Returns the component.
returns a clone of the component.
returns a new array containing all of the components children.
passes the component through the requested component constructor.
Returns whether the component has been extended with the given type
The base fastn component doesn't implement some properties that are expected for normal operation. Most base components implement these properties, but if you want to create a totally custom component, you may have to implement them
Renderes the component.
render must:
- assign an object of some kind to component.element (for example, a DOM node).
- emit('render')