File: example.js

package info (click to toggle)
node-when 3.7.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 820 kB
  • sloc: makefile: 16; sh: 5
file content (10 lines) | stat: -rw-r--r-- 319 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
when = require('when');

/* a very simple promise */
when(2, x => x+3)
.then(result => console.log('The result of 2+3 is ' + result))

/* an erroneous promise */
when(0, function (x) { throw new Error('oups!')})
.then(result => console.log('The value would be:' + result))
.catch(err => console.log('Catched: ' + err))