Guest User

Untitled

a guest
Mar 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. // start logging
  2. // log 42
  3. // process 42
  4. Promise.resolve(42)
  5. .tap(x => asyncLogging(x))
  6. .then(x => console.log(`process ${x}`));
  7.  
  8. function asyncLogging(x) {
  9. console.log('start logging');
  10.  
  11. return new Promise(resolve => setTimeout(() => {
  12. console.log(`log ${x}`);
  13. resolve();
  14. }, 1000));
  15. }
Add Comment
Please, Sign In to add comment