fcoin/lib/bcoin/worker.js
Christopher Jeffrey 6fb0689ce4
worker debug.
2016-05-06 23:56:08 -07:00

29 lines
764 B
JavaScript

/*!
* worker.js - worker thread/process for bcoin
* Copyright (c) 2014-2015, Fedor Indutny (MIT License)
* Copyright (c) 2014-2016, Christopher Jeffrey (MIT License).
* https://github.com/indutny/bcoin
*/
var penv, env;
if (typeof importScripts !== 'undefined') {
self.importScripts('/bcoin.js');
self.onmessage = function onmessage(event) {
self.onmessage = function() {};
penv = JSON.parse(event.data);
env = self.bcoin.env(penv.BCOIN_WORKER_NETWORK);
env.workers.listen(+penv.BCOIN_WORKER_ID, {
debug: +penv.BCOIN_WORKER_DEBUG === 1
});
};
} else {
penv = process.env;
env = require('./env')(penv.BCOIN_WORKER_NETWORK);
env.workers.listen(+penv.BCOIN_WORKER_ID, {
debug: +penv.BCOIN_WORKER_DEBUG === 1
});
}