this._target["invokeScriptAsync"]) {
                this._target["invokeScriptAsync"]("CloudExperienceHost.Bridge.dispatchMessage", msg).start();
            }
            else {
                this._windowExternalNotifyInternal(msg, 0);
            }
        }
        _invokeLocal(m) {
            this._contractHandler.invokeFromString(this._target.src, m.value.name, m.value.args).done(function (result) {
                if (m.value.context) {
                    this._callback(m, result, false);
                }
            }.bind(this), function (e) {
                if (m.value.context) {
                    this._callback(m, e, true);
                }
            }.bind(this));
        }
        _receivedEvent(e) {
            if (this._contractHandler && this._contractHandler.rules && this._contractHandler.rules.hasOwnProperty(e.value.name)) {
                this._contractHandler.checkIfPermissionAllowed(this._target.src, e.value.name);
            }
            var listeners = this._listeners[e.value.name];
            if (listeners) {
                listeners.map(function (listener) {
                    listener.call(this, e.value.data);
                }.bind(this));
            }
        }
        _receivedResult(m) {
            var callback = this._callbackContext[m.value.context];
            if (callback) {
                if (m.value.iserror) {
                    callback.error(m.value.result);
                }
                else {
                    callback.complete(m.value.result);
                }
                //Cleaning
                this._callbackContext[m.value.context] = null;
                delete this._callbackContext[m.value.context];
            }
        }
        _dispatchMessageFromScriptNotify(notification) {
            this._dispatchMessage(notification.value);
        }
        _dispatchMessage(message) {
            var msg = Channel.parse(message);
            if (msg.type == Channel.MessageType.invoke) {
     