A base class for viewable content and event targets inside a Famo.us application, containing a renderable document fragment. Like an HTML div, it can accept internal markup, properties, classes, and handle events.
Bind a callback function to an event type handled by this object.
Parameters
type
String
event type key (for example, 'click')
fn
Function(string, Object)
handler callback
Returns
EventHandler
this
removeListener(type, fn)
Unbind an event by type and handler. This undoes the work of "on"
Parameters
type
String
event type key (for example, 'click')
fn
Function(string, Object)
handler
emit(type, event)
Trigger an event, sending to all downstream handlers listening for provided 'type' key.
Parameters
type
String
event type key (for example, 'click')
event
Object
event data
Returns
EventHandler
this
pipe(target)
Add event handler object to set of downstream handlers.
Parameters
target
EventHandler
event handler target object
Returns
EventHandler
passed event handler
unpipe(target)
Remove handler object from set of downstream handlers. Undoes work of "pipe"
Parameters
target
EventHandler
target handler object
Returns
EventHandler
provided target
render()Private
Return spec for this surface. Note that for a base surface, this is simply an id.
Returns
Object
render spec for this surface (spec id)
_formatCSSTransform(m)Private
Return a Matrix's webkit css representation to be used with the CSS3 -webkit-transform style. Example: -webkit-transform: matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,716,243,0,1)
Parameters
m
FamousMatrix
matrix
Returns
String
matrix3d CSS style representation of the transform
setMatrix(element, matrix)PrivateStatic
Directly apply given FamousMatrix to the document element as the appropriate webkit CSS style.
Parameters
element
Element
document element
matrix
FamousMatrix
commit(context)Private
Apply changes from this component to the corresponding document element. This includes changes to classes, styles, size, content, opacity, origin, and matrix transforms.
Parameters
context
Context
commit context
attach(target)Private
Place the document element that this component manages into the document.
Parameters
target
Node
document parent of this container
detach()Private
Remove any contained document content associated with this surface from the actual document.