mirror of
https://github.com/amark/gun.git
synced 2025-06-03 04:36:53 +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
|
||||
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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user