[Pkg-javascript-commits] [node-when] 06/08: Add a pretty simple example to show the basic idea

Julien Puydt julien.puydt at laposte.net
Sun Aug 27 09:17:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-when.

commit 08795a877d2a606be70bfad37a85a4a0cd953ea7
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Sat Aug 26 22:55:08 2017 +0200

    Add a pretty simple example to show the basic idea
---
 debian/example.js | 10 ++++++++++
 debian/examples   |  1 +
 2 files changed, 11 insertions(+)

diff --git a/debian/example.js b/debian/example.js
new file mode 100644
index 0000000..193f7b1
--- /dev/null
+++ b/debian/example.js
@@ -0,0 +1,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))
diff --git a/debian/examples b/debian/examples
new file mode 100644
index 0000000..c9ccb9c
--- /dev/null
+++ b/debian/examples
@@ -0,0 +1 @@
+debian/example.js

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-when.git



More information about the Pkg-javascript-commits mailing list