1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Navigator test: added worker test

Fixes #458
This commit is contained in:
kkapsner 2020-04-13 10:10:44 +02:00
parent 87fa607d28
commit 308d7c4005
3 changed files with 76 additions and 5 deletions

View file

@ -0,0 +1,24 @@
(function(){
"use strict";
const values = {};
const navigator = self.navigator;
Object.keys(navigator.__proto__).sort().forEach(function(property){
const value = navigator[property];
if ((typeof value) === "string"){
values[property] = value;
}
});
if (self.postMessage){
self.postMessage(values);
}
self.addEventListener("connect", function(event){
event.ports.forEach(function(port){
port.postMessage(values);
});
});
self.addEventListener("message", function(event){
event.source.postMessage(values);
return values;
});
}());