/*! * 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/bcoin-org/bcoin */ 'use strict'; /* jshint worker: true */ var bcoin, env; if (typeof importScripts !== 'undefined') { self.importScripts('/bcoin.js'); bcoin = self.bcoin; self.onmessage = function onmessage(event) { self.onmessage = function() {}; env = JSON.parse(event.data); bcoin.set(env.BCOIN_WORKER_NETWORK); bcoin.workers.listen(); }; } else { env = process.env; bcoin = require('../env'); bcoin.set(env.BCOIN_WORKER_NETWORK); bcoin.workers.listen(); }