Y.mojito.Client Class
The starting point for mojito to run in the browser. You can access one instance of the Mojito Client running within the browser environment through window.YMojito.client.
Item Index
Methods
attachBinders
-
binderMap
-
parentId
-
topLevelMojitViewId
Given a set of binder information, initialize binder instances and bind them to the page.
Parameters:
-
binderMap
ObjectviewId ==> binder data, contains all we need from the mojit dispatch's meta object about all the binders that were executed to create the DOM addition recently added to the document.
-
parentId
Stringthe parent binder view id to attach any children.
-
topLevelMojitViewId
Stringthe topmost (root) binder view id to attach as a child to the parent.
destroyMojitProxy
-
id
-
retainNode
Parameters:
-
id
StringThe mojit's viewId to destroy
-
retainNode
Boolean
executeAction
-
command
-
viewId
-
cb
Used for binders to execute their actions through the Mojito framework through their proxies.
Parameters:
-
command
Objectmust contain mojit id and action to execute.
-
viewId
Stringthe view id of the current mojit, which is executing the action.
-
cb
Functioncallback to run when complete.
fireLifecycle
-
evt
-
data
Fires a lifecycle event.
Parameters:
-
evt
StringThe name of event to fire.
-
data
ObjectThe data to pass to listeners.
pause
()
Pause the Mojito Client and all mojits that are running. This will notify all binders that they have been paused by calling their onPause() functions. It will prevent the immediate execution of several mojit proxy operations that might cause a long process to begin (especially things that might go to the server).
To resume, simply call .resume(). This will immediately execute all actions that occurred while Mojito was paused.
resume
()
Resumes the Mojito client after it has been paused (see method "pause"). If there are any queued actions that were executed and cached during the pause, calling resume() will immediately execute them. All binders are notified through their onResume() function that they are been resumed.
subscribe
-
evt
-
cb
Subscribe to a MojitoClient lifecycle event.
Parameters:
-
evt
Stringname of event to subscribe to.
-
cb
Function(data)callback called when the event fires.