1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 /* eslint-env mozilla/worker */
6 // Trivial worker definition
8 import { PromiseWorker } from "resource://gre/modules/workers/PromiseWorker.mjs";
10 var worker = new PromiseWorker.AbstractWorker();
11 worker.dispatch = function (method, args = []) {
12 return Agent[method](...args);
14 worker.postMessage = function (...args) {
15 self.postMessage(...args);
17 worker.close = function () {
20 worker.log = function (...args) {
21 dump("Worker: " + args.join(" ") + "\n");
23 self.addEventListener("message", msg => worker.handleMessage(msg));
24 self.addEventListener("unhandledrejection", function (error) {