Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // start logging
- // log 42
- // process 42
- Promise.resolve(42)
- .tap(x => asyncLogging(x))
- .then(x => console.log(`process ${x}`));
- function asyncLogging(x) {
- console.log('start logging');
- return new Promise(resolve => setTimeout(() => {
- console.log(`log ${x}`);
- resolve();
- }, 1000));
- }
Add Comment
Please, Sign In to add comment