Class: SC.StatechartDelegate

Apply to objects that are to represent a delegate for a SC.Statechart object. When assigned to a statechart, the statechart and its associated states will use the delegate in order to make various decisions.

Defined in: statechart_delegate.js

See:
SC.Statechart#delegate

Instance Methods

Instance Method Detail

statechartAcquireLocationForState(statechart, state)
Called to acquire the application's current location.
Parameters:
statechart SC.StatechartManager
the statechart
state SC.State
the state requesting the location
Returns:
String
the location
statechartBindStateToRoute(statechart, state, route, handler)

Used to bind a state's handler to a route. When the application's location matches the given route, the state's handler is to be invoked.

The statechart and states remain completely independent of how the underlying routing mechanism works thereby providing a looser coupling and more flexibility in how routing is to work. Given this flexiblity, it is important that a route assigned (using the {@link SC.State#representRoute} property) to a state strictly conforms to the underlying routing mechanism's criteria in order for the given handler to be properly invoked.

By default the {@link SC.routes} mechanism is used to bind the state's handler with the given route.

Parameters:
statechart SC.StatechartManager
the statechart
state SC.State
the state to bind the route to
route String|Hash
the route that is to be bound to the state
handler Function|String
the method on the state to be invoked when the route gets triggered.
See:
SC.State#representRoute
statechartShouldStateHandleTriggeredRoute(statechart, state, routeContext)

Invoked by a state that has been notified to handle a triggered route. The state asks if it should go ahead an actually handle the triggered route. If no then the state's handler will no longer continue and finish by calling this delegate's statechartStateCancelledHandlingTriggeredRoute method. If yes then the state will continue with handling the triggered route.

By default YES is returned.

Parameters:
statechart SC.StatechartManager
the statechart
state SC.State
the state making the request
routeContext SC.StateRouteHandlerContext
contextual information about the handling of a route
See:
#statechartStateCancelledHandlingTriggeredRoute
statechartStateCancelledHandlingTriggeredRoute(statechart, state, routeContext)

Invoked by a state that has been informed by the delegate to not handle a triggered route. Used this for any additional clean up or processing that you may wish to perform.

Parameters:
statechart SC.StatechartManager
the statechart
state SC.State
the state making the request
routeContext SC.StateRouteHandlerContext
contextual information about the handling of a route
See:
#statechartShouldStateHandleTriggeredRoute
statechartUpdateLocationForState(statechart, location, state)

Called to update the application's current location.

The location provided is dependent upon the application's underlying routing mechanism.

Parameters:
statechart SC.StatechartManager
the statechart
location String|Hash
the new location
state SC.State
the state requesting the location update
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)