Call the handler if onReady is called for a ready channel

This commit is contained in:
yflory
2017-12-11 12:48:06 +01:00
parent dcfccf88cd
commit 89cc583f53
2 changed files with 7 additions and 3 deletions

View File

@@ -110,9 +110,13 @@ define([
chan.whenReg('EV_REGISTER_HANDLER', evReady.fire);
// Make sure both iframes are ready
var isReady =false;
chan.onReady = function (h) {
if (isReady) {
return void h();
}
if (typeof(h) !== "function") { return; }
chan.on('EV_RPC_READY', function () { h(); });
chan.on('EV_RPC_READY', function () { isReady = true; h(); });
};
chan.ready = function () {
chan.whenReg('EV_RPC_READY', function () {