//author:herbert qq:464884492 onmessage = function (event) { if (event.data.code) { var code = event.data.code.toLowerCase(); switch (code) { case "init": var userId = event.data.loggedUserId; var sessionId = event.data.sessionid; if (!sessionId) { this.close(); return; } postMessage({ code: "codeone", msg: "你好,组件1" }); postMessage({ code: "codetwo", msg: "你好,组件2" }); break; default: break; } } }
WebWorker与WebSocket实现前端消息总线 (4)
内容版权声明:除非注明,否则皆为本站原创文章。