asynchronous send on Bus

This commit is contained in:
copy 2015-01-06 20:22:42 +01:00
parent d095a9880d
commit cdd87cd99a

View file

@ -30,6 +30,8 @@ Bus.Connector.prototype.register = function(name, fn, thisValue)
};
/**
* Send ("emit") a message
*
* @param {string} name
* @param {Object=} value
*/
@ -56,6 +58,19 @@ Bus.Connector.prototype.send = function(name, value)
}
};
/**
* Send a message, guaranteeing that it is received asynchronously
*
* @param {string} name
* @param {Object=} value
*/
Bus.Connector.prototype.send_async = function(name, value)
{
dbg_assert(arguments.length === 1 || arguments.length === 2);
setTimeout(this.send.bind(this, name, value), 0);
};
Bus.create = function()
{