blob: 750ae45f969491ea29eaa47c85f96f97d94b415f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
if (typeof ServiceWorkerGlobalScope === "function") {
self.onmessage = function (e) { e.source.postMessage("ping"); };
} else if (typeof SharedWorkerGlobalScope === "function") {
onconnect = function (e) {
var port = e.ports[0];
port.onmessage = function () { port.postMessage("ping"); }
port.postMessage("ping");
};
} else if (typeof DedicatedWorkerGlobalScope === "function") {
self.postMessage("ping");
}
|