MCPcopy Create free account
hub / github.com/codecombat/codecombat / onGlobalMessage

Function onGlobalMessage

app/assets/javascripts/setImmediate.js:135–143  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

133 }
134
135 function onGlobalMessage(event) {
136 // This will catch all incoming messages (even from other windows!), so we need to try reasonably hard to
137 // avoid letting anyone else trick us into firing off. We test the origin is still this window, and that a
138 // (randomly generated) unpredictable identifying prefix is present.
139 if (event.source === global && isStringAndStartsWith(event.data, MESSAGE_PREFIX)) {
140 var handle = event.data.substring(MESSAGE_PREFIX.length);
141 tasks.runIfPresent(handle);
142 }
143 }
144 if (global.addEventListener) {
145 global.addEventListener("message", onGlobalMessage, false);
146 } else {

Callers

nothing calls this directly

Calls 1

isStringAndStartsWithFunction · 0.85

Tested by

no test coverage detected