fix: bug when import 'lib/then'

This commit is contained in:
bluelovers 2020-02-06 20:54:42 +08:00
parent 60c98a5ba0
commit 16f911e126

View File

@ -11,11 +11,12 @@ Gun.chain.promise = function(cb) {
};
// Returns a promise for the data, key of the gun call
Gun.chain.then = function() {
Gun.chain.then = function(cb) {
var gun = this;
return (new Promise((res, rej)=>{
var p = (new Promise((res, rej)=>{
gun.once(function (data, key) {
res(data, key); //call resolve when data is returned
})
}))
return cb ? p.then(cb) : p;
};