update index file and examples
This commit is contained in:
parent
c00ca5b23f
commit
f9fef7a07f
58
example/as.js
Normal file
58
example/as.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
var async = require('async');
|
||||||
|
|
||||||
|
var d = Date.now();
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
function fn1(next) {
|
||||||
|
console.log('fn1');
|
||||||
|
setImmediate(function() {
|
||||||
|
next(null, [])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fn2(next) {
|
||||||
|
console.log('fn2');
|
||||||
|
setImmediate(function() {
|
||||||
|
next(null, [])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async.whilst(
|
||||||
|
function() {
|
||||||
|
return i < 100000;
|
||||||
|
},
|
||||||
|
function(callback) {
|
||||||
|
i++;
|
||||||
|
async.series(
|
||||||
|
[
|
||||||
|
fn1.bind(this),
|
||||||
|
fn2.bind(this)
|
||||||
|
],
|
||||||
|
callback
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
console.log('Milliseconds', Date.now() - d);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/*async.times(100000, function(n, next) {
|
||||||
|
async.series(
|
||||||
|
[
|
||||||
|
function fn1(next) {
|
||||||
|
setImmediate(function() {
|
||||||
|
next(null, []);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function fn2(next) {
|
||||||
|
setImmediate(function() {
|
||||||
|
next(null, []);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
],
|
||||||
|
next
|
||||||
|
);
|
||||||
|
}, function() {
|
||||||
|
console.log('Milliseconds', Date.now() - d);
|
||||||
|
});*/
|
||||||
@ -10,7 +10,7 @@ process.title = 'bitcoind.js';
|
|||||||
* bitcoind
|
* bitcoind
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var bitcoind = require('../index.js')({
|
var bitcoind = require('../index.js').bitcoind({
|
||||||
directory: '~/.bitcoin'
|
directory: '~/.bitcoin'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ process.title = 'bitcoind.js';
|
|||||||
* bitcoind
|
* bitcoind
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var bitcoind = require('../')({
|
var bitcoind = require('../').bitcoind({
|
||||||
directory: process.env.BITCOINDJS_DIR || '~/.bitcoin'
|
directory: process.env.BITCOINDJS_DIR || '~/.bitcoin'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var BitcoinNode = require('../lib/node');
|
var BitcoindJS = require('..');
|
||||||
|
var BitcoinNode = BitcoindJS.Node;
|
||||||
var chainlib = require('chainlib');
|
var chainlib = require('chainlib');
|
||||||
var log = chainlib.log;
|
var log = chainlib.log;
|
||||||
log.debug = function() {};
|
//log.debug = function() {};
|
||||||
|
|
||||||
var privkey = 'tprv8ZgxMBicQKsPdj1QowoT9z1tY5Et38qaMjCHZVoPdPFb6narfmYkqTygEVHfUmY78k3HcaEpkyNCAQDANaXtwNe1HLFvcA7nqYj1B7wTSTo';
|
var privkey = 'tprv8ZgxMBicQKsPdj1QowoT9z1tY5Et38qaMjCHZVoPdPFb6narfmYkqTygEVHfUmY78k3HcaEpkyNCAQDANaXtwNe1HLFvcA7nqYj1B7wTSTo';
|
||||||
|
|
||||||
14
index.js
14
index.js
@ -1 +1,13 @@
|
|||||||
module.exports = require('./lib/bitcoind.js');
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {};
|
||||||
|
module.exports.bitcoind = require('./lib/bitcoind');
|
||||||
|
module.exports.Node = require('./lib/node');
|
||||||
|
module.exports.Block = require('./lib/block');
|
||||||
|
module.exports.Chain = require('./lib/chain');
|
||||||
|
module.exports.DB = require('./lib/db');
|
||||||
|
module.exports.Transaction = require('./lib/transaction');
|
||||||
|
module.exports.errors = require('./lib/errors');
|
||||||
|
|
||||||
|
module.exports.deps = {};
|
||||||
|
module.exports.deps.chainlib = require('chainlib');
|
||||||
Loading…
Reference in New Issue
Block a user