Skip to content

Overridable methods

Stuk edited this page Mar 12, 2013 · 6 revisions

You can implement certain methods on your objects and components that will be called. This is a list of them until we have more JSDoc documentation.

Object

didCreate

Constructor called after the object is created

component

prepareForDraw

Called before the first draw of the component. This is where you should add any event listeners on your DOM elements, except for touch or mouse event listeners (see prepareForActivationEvents).

prepareForActivationEvents

Called the first time a touch event or mouse event is received on one of your child elements. This is where you should add any events that occur after user interaction. TODO called after focus event?

willDraw

Called before the draw of the component. This is where you should read any values from the DOM (for example the styles of you element or child elements). See draw.

draw

This is the only place that your component should modify the DOM. By putting DOM reads in willDraw and DOM writes in draw all the reads and all the writes are batched together, which reduces the number of browser repaints and increases the fluidity of your app.

contentWillChange

Called before the domContent of the component is changed.

contentDidChange

Called after the domContent of the component is changed.

childComponentWillPrepareForDraw

Called before a child component's willPrepareForDraw.

willPrepareForDraw