B2G/gecko/toolkit/components/osfile/osfile_async_front.jsm
/**
   * Post a message to a worker.
   *
   * @param {string} fun The name of the function to call.
   * @param array The contents of the message.
   * @param closure An object holding references that should not be
   * garbage-collected before the message treatment is complete.
   *
   * @return {promise}
   */
Post a message to a worker.
@param {string} fun The name of the function to call.
@param array The contents of the message.
@param closure An object holding references that should not be
garbage-collected before the message treatment is complete.

@return {promise}
Post a message to a worker . @param { string } fun The name of the function to call . @param array The contents of the message . @param closure An object holding references that should not be garbage - collected before the message treatment is complete . @return { promise }
function post(fun, array, closure) {
    let deferred = Promise.defer();
    let id = ++this._id;
    let message = {fun: fun, args: array, id: id};
    if (DEBUG) {
      LOG("Posting message", JSON.stringify(message));
    }
    this._queue.push({deferred:deferred, closure: closure, id: id});
    this._worker.postMessage(message);
    if (DEBUG) {
      LOG("Message posted");
    }
    return deferred.promise;
  }
function post ( fun , array , closure ) { let deferred = Promise . defer ( ) ; let id = ++ this . _id ; let message = { fun : fun , args : array , id : id } ; if ( DEBUG ) { LOG ( "Posting message" , JSON . stringify ( message ) ) ; } this . _queue . push ( { deferred : deferred , closure : closure , id : id } ) ; this . _worker . postMessage ( message ) ; if ( DEBUG ) { LOG ( "Message posted" ) ; } return deferred . promise ; }
Post a message to a worker.
Post a message to a worker .