www.webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Resources API Reference Mojo.Function.Synchronize

Mojo.Function.Synchronize

Class used to ensure a set of functions are called simultaneously.  After creating a Mojo.Function.Synchronize object, the wrap() method can then be used to wrap callbacks to be synchronized before passing them to an asynchronous service.  The Synchronize object will "collect" the asynchronous callbacks until all have been received, then call the wrapped functions simultaneously.

Example usage:

    var synchronizer = new Mojo.Function.Synchronize({
syncCallback: this.continueSceneTransition()});
var doNothing = function() {};
var otherWrapper = synchronizer.wrap(doNothing);

curScene.aboutToActivate(synchronizer.wrap(doNothing));
beginOtherOperation(otherWrapper);
Parameter Type Description
inOptions Object Synchronization options.  See below.

inOptions object properties:

Property Type Description
syncCallback Function Called after all callbacks have been dispatched.  Passed a Boolean that is set to true if the synchronizer timed out. Optional.
timeout Number Number of seconds after which the synchronizer stops waiting, at which point all received wrapped functions and syncCallback are called.  Functions not yet returned are ignored but subsequent calls to them are immediately processed by the synchronize object.
 

0 Comments

    Add Comment


      • >:o
      • :-[
      • :'(
      • :-(
      • :-D
      • :-*
      • :-)
      • :P
      • :\
      • 8-)
      • ;-)