This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function promised(fn) { | |
return function(cb) { | |
return new Promise(function(resolve, reject) { | |
fn(function { cb(); resolve() }); | |
}); | |
} | |
} | |
promised(myAsync)(myCallback).then(...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const execa = require('execa'); | |
const getStream = require('get-stream'); | |
let foo = execa.shell('sleep 3 && echo foo'); | |
foo.then((result)=>{ | |
console.log('Done'); | |
console.log(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = []; | |
foo[0] = () => { | |
return new Promise((resolve,reject) => { | |
setTimeout(() =>{ | |
console.log('a'); | |
resolve(1); | |
}, 100); | |
}); |
OlderNewer