API Docs for: 0.7.5
Show:

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.

Methods

attachBinders

(
  • binderMap
  • parentId
  • topLevelMojitViewId
)
private

Given a set of binder information, initialize binder instances and bind them to the page.

Parameters:

  • binderMap Object

    viewId ==> 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 String

    the parent binder view id to attach any children.

  • topLevelMojitViewId String

    the topmost (root) binder view id to attach as a child to the parent.

destroyMojitProxy

(
  • id
  • retainNode
)

Parameters:

  • id String

    The mojit's viewId to destroy

  • retainNode Boolean

executeAction

(
  • command
  • viewId
  • cb
)
private

Used for binders to execute their actions through the Mojito framework through their proxies.

Parameters:

  • command Object

    must contain mojit id and action to execute.

  • viewId String

    the view id of the current mojit, which is executing the action.

  • cb Function

    callback to run when complete.

fireLifecycle

(
  • evt
  • data
)
private

Fires a lifecycle event.

Parameters:

  • evt String

    The name of event to fire.

  • data Object

    The 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 String

    name of event to subscribe to.

  • cb Function(data)

    callback called when the event fires.