bcoin: refactor.
This commit is contained in:
parent
1aa0858f7c
commit
56252921c1
@ -125,6 +125,28 @@
|
||||
|
||||
var bcoin = exports;
|
||||
|
||||
/**
|
||||
* Set the default network.
|
||||
* @param {String} network
|
||||
*/
|
||||
|
||||
bcoin.set = function set(network) {
|
||||
bcoin.network.set(network);
|
||||
return bcoin;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cache all necessary modules.
|
||||
*/
|
||||
|
||||
bcoin.cache = function cache() {
|
||||
;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
// Horrible BIP
|
||||
bcoin.bip70 = require('./bip70');
|
||||
|
||||
@ -249,26 +271,8 @@ bcoin.walletplugin = require('./wallet/plugin');
|
||||
bcoin.workers = require('./workers');
|
||||
bcoin.workerpool = require('./workers/workerpool');
|
||||
|
||||
/**
|
||||
* Set the default network.
|
||||
* @param {String} network
|
||||
*/
|
||||
|
||||
bcoin.set = function set(network) {
|
||||
bcoin.network.set(network);
|
||||
return bcoin;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cache all necessary modules.
|
||||
*/
|
||||
|
||||
bcoin.cache = function cache() {
|
||||
;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
* Expose Globally
|
||||
*/
|
||||
|
||||
global.bcoin = bcoin;
|
||||
|
||||
78
lib/bcoin.js
78
lib/bcoin.js
@ -125,6 +125,48 @@
|
||||
|
||||
var bcoin = exports;
|
||||
|
||||
/**
|
||||
* Define a module for lazy loading.
|
||||
* @param {String} name
|
||||
* @param {String} path
|
||||
*/
|
||||
|
||||
bcoin.define = function _require(name, path) {
|
||||
var cache;
|
||||
bcoin.__defineGetter__(name, function() {
|
||||
if (!cache)
|
||||
cache = require(path);
|
||||
return cache;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the default network.
|
||||
* @param {String} network
|
||||
*/
|
||||
|
||||
bcoin.set = function set(network) {
|
||||
bcoin.network.set(network);
|
||||
return bcoin;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cache all necessary modules.
|
||||
*/
|
||||
|
||||
bcoin.cache = function cache() {
|
||||
bcoin.bip70;
|
||||
bcoin.common;
|
||||
bcoin.crypto;
|
||||
bcoin.fullnode;
|
||||
bcoin.http;
|
||||
bcoin.spvnode;
|
||||
};
|
||||
|
||||
/*
|
||||
* Expose
|
||||
*/
|
||||
|
||||
// Horrible BIP
|
||||
bcoin.define('bip70', './bip70');
|
||||
|
||||
@ -248,39 +290,3 @@ bcoin.define('walletplugin', './wallet/plugin');
|
||||
// Workers
|
||||
bcoin.define('workers', './workers');
|
||||
bcoin.define('workerpool', './workers/workerpool');
|
||||
|
||||
/**
|
||||
* Set the default network.
|
||||
* @param {String} network
|
||||
*/
|
||||
|
||||
bcoin.set = function set(network) {
|
||||
bcoin.network.set(network);
|
||||
return bcoin;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cache all necessary modules.
|
||||
*/
|
||||
|
||||
bcoin.cache = function cache() {
|
||||
bcoin.bip70;
|
||||
bcoin.common;
|
||||
bcoin.crypto;
|
||||
bcoin.fullnode;
|
||||
bcoin.http;
|
||||
bcoin.spvnode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Cache all necessary modules.
|
||||
*/
|
||||
|
||||
bcoin.define = function _require(name, path) {
|
||||
var cache;
|
||||
bcoin.__defineGetter__(name, function() {
|
||||
if (!cache)
|
||||
cache = require(path);
|
||||
return cache;
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user