then.js 206 B

123456789
  1. var Gun = require('./sea').Gun;
  2. Gun.chain.then = function(cb){
  3. var gun = this, p = (new Promise(function(res, rej){
  4. gun.once(res);
  5. }));
  6. return cb? p.then(cb) : p;
  7. }