mirror of
https://github.com/amark/gun.git
synced 2025-06-06 06:06:50 +00:00
fix: bug when import 'lib/then'
This commit is contained in:
parent
60c98a5ba0
commit
16f911e126
@ -11,11 +11,12 @@ Gun.chain.promise = function(cb) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Returns a promise for the data, key of the gun call
|
// Returns a promise for the data, key of the gun call
|
||||||
Gun.chain.then = function() {
|
Gun.chain.then = function(cb) {
|
||||||
var gun = this;
|
var gun = this;
|
||||||
return (new Promise((res, rej)=>{
|
var p = (new Promise((res, rej)=>{
|
||||||
gun.once(function (data, key) {
|
gun.once(function (data, key) {
|
||||||
res(data, key); //call resolve when data is returned
|
res(data, key); //call resolve when data is returned
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
|
return cb ? p.then(cb) : p;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user