then.js 206 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 var Gun = require('./sea').Gun; Gun.chain.then = function(cb){ var gun = this, p = (new Promise(function(res, rej){ gun.once(res); })); return cb? p.then(cb) : p; }