Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 1d0a1c3

Browse files
Fixing strict mode error in postMessage
1 parent 3f12183 commit 1d0a1c3

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/core/concurrency/defaultscheduler.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,14 @@
8686
} else if (postMessageSupported()) {
8787
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
8888

89-
function onGlobalPostMessage(event) {
89+
var onGlobalPostMessage = function (event) {
9090
// Only if we're a match to avoid any other global events
9191
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
9292
runTask(event.data.substring(MSG_PREFIX.length));
9393
}
94-
}
94+
};
9595

96-
if (root.addEventListener) {
97-
root.addEventListener('message', onGlobalPostMessage, false);
98-
} else if (root.attachEvent) {
99-
root.attachEvent('onmessage', onGlobalPostMessage);
100-
} else {
101-
root.onmessage = onGlobalPostMessage;
102-
}
96+
root.addEventListener('message', onGlobalPostMessage, false);
10397

10498
scheduleMethod = function (action) {
10599
var id = nextHandle++;

0 commit comments

Comments
 (0)