MCPcopy Index your code
hub / github.com/dresende/node-orm2 / Promise

Function Promise

lib/DeprecatedPromise.js:3–30  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

1exports.Promise = Promise;
2
3function Promise(opts) {
4 opts = opts || {};
5
6 var success_cb = opts.success || null;
7 var fail_cb = opts.fail || null;
8
9 return {
10 handle: function (promise) {
11 promise(function (err) {
12 if (err) {
13 if (fail_cb) fail_cb(err);
14 } else {
15 var args = Array.prototype.slice.call(arguments, 1);
16
17 if (success_cb) success_cb.apply(null, args);
18 }
19 });
20 },
21 success: function (cb) {
22 success_cb = cb;
23 return this;
24 },
25 fail: function (cb) {
26 fail_cb = cb;
27 return this;
28 }
29 };
30}

Callers

nothing calls this directly

Calls 2

promiseFunction · 0.85
callMethod · 0.80

Tested by

no test coverage detected