"use strict";
_kangoLoader.add("kango/message_target", function(require, exports, module) {
function MessageTargetModule(e){var n={},t=this.addMessageListener=function(e,t){if("undefined"!=typeof t.call&&"undefined"!=typeof t.apply){n[e]=n[e]||[];for(var r=0;r<n[e].length;r++)if(n[e][r]==t)return!1;return n[e].push(t),!0}return!1};this.removeMessageListener=function(e,t){if("undefined"!=typeof n[e])for(var r=0;r<n[e].length;r++)if(n[e][r]==t)return n[e].splice(r,1),!0;return!1},this.removeAllMessageListeners=function(){n={}},e("message",function(e){var t=e.name;if("undefined"!=typeof n[t])for(var r=0;r<n[t].length;r++){var s=!1;if("unknown"==typeof n[t][r].call)s=!0;else try{n[t][r](e)}catch(i){if(-2146828218!=i.number&&-2146823277!=i.number)throw i;s=!0}s&&(n[t].splice(r,1),r--)}}),this.onMessage=function(e,n,r){t(e,function(e){n(e.data,function(n,t){e.source.dispatchMessage(n,t)})})}}"undefined"!=typeof module&&(module.exports=MessageTargetModule);
});