(self)
| 9 | var invocationIdCounter = 0; |
| 10 | |
| 11 | var workerFunc = function (self) { |
| 12 | self.onmessage = function (e) { |
| 13 | switch (e.data.type) { |
| 14 | case "init": |
| 15 | self.importScripts(e.data._hyperscript); |
| 16 | self.importScripts.apply(self, e.data.extraScripts); |
| 17 | const _hyperscript = self['_hyperscript'] |
| 18 | var hyperscript = _hyperscript.parse(e.data.src); |
| 19 | hyperscript.apply(self, self); |
| 20 | postMessage({ type: "didInit" }); |
| 21 | break; |
| 22 | case "call": |
| 23 | try { |
| 24 | var result = self['_hyperscript'].internals.runtime |
| 25 | .getHyperscriptFeatures(self)[e.data.function] |
| 26 | .apply(self, e.data.args); |
| 27 | Promise.resolve(result) |
| 28 | .then(function (value) { |
| 29 | postMessage({ |
| 30 | type: "resolve", |
| 31 | id: e.data.id, |
| 32 | value: value, |
| 33 | }); |
| 34 | }) |
| 35 | .catch(function (error) { |
| 36 | postMessage({ |
| 37 | type: "reject", |
| 38 | id: e.data.id, |
| 39 | error: error.toString(), |
| 40 | }); |
| 41 | }); |
| 42 | } catch (error) { |
| 43 | postMessage({ |
| 44 | type: "reject", |
| 45 | id: e.data.id, |
| 46 | error: error.toString(), |
| 47 | }); |
| 48 | } |
| 49 | break; |
| 50 | } |
| 51 | }; |
| 52 | }; |
| 53 | |
| 54 | var workerCode = "(" + workerFunc.toString() + ")(self)"; |
| 55 | var blob = new Blob([workerCode], { type: "text/javascript" }); |
nothing calls this directly
no test coverage detected