MCPcopy Index your code
hub / github.com/codecombat/codecombat / canUsePostMessage

Function canUsePostMessage

app/assets/javascripts/setImmediate.js:74–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 function canUsePostMessage() {
75 // The test against `importScripts` prevents this implementation from being installed inside a web worker,
76 // where `global.postMessage` means something completely different and can't be used for this purpose.
77
78 if (!global.postMessage || global.importScripts) {
79 return false;
80 }
81
82 var postMessageIsAsynchronous = true;
83 var oldOnMessage = global.onmessage;
84 global.onmessage = function () {
85 postMessageIsAsynchronous = false;
86 };
87 global.postMessage("", "*");
88 global.onmessage = oldOnMessage;
89
90 return postMessageIsAsynchronous;
91 }
92
93 function canUseReadyStateChange() {
94 return "document" in global && "onreadystatechange" in global.document.createElement("script");

Callers 1

setImmediate.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected