linx-simulator2/node_modules/mumble-client-codecs-node/lib/webworkify-node.js

27 lines
634 B
JavaScript
Raw Normal View History

2019-09-18 08:11:16 +00:00
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (workerFactory) {
var worker = new _events.EventEmitter();
worker.addEventListener = worker.on;
workerFactory(worker);
var client = {
onmessage: function onmessage() {},
postMessage: function postMessage(msg) {
process.nextTick(function () {
return worker.emit('message', { data: msg });
});
}
};
worker.postMessage = function (msg) {
process.nextTick(function () {
return client.onmessage({ data: msg });
});
};
return client;
};
var _events = require('events');