Browse Source

Version 0.1.0.

Herbert Vojčík 8 years ago
parent
commit
1a7259e13f
3 changed files with 64 additions and 0 deletions
  1. 24 0
      lib/node.js
  2. 28 0
      package.json
  3. 12 0
      src/node.js

+ 24 - 0
lib/node.js

@@ -0,0 +1,24 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+    value: true
+});
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+/*
+ * Deferred pattern built on top of Promise.
+ */
+
+var Deferred = function Deferred() {
+    var _this = this;
+
+    _classCallCheck(this, Deferred);
+
+    this.promise = new Promise(function (resolve, reject) {
+        _this.resolve = resolve;
+        _this.reject = reject;
+    });
+};
+
+exports.default = Deferred;

+ 28 - 0
package.json

@@ -0,0 +1,28 @@
+{
+  "name": "deferred-lite",
+  "version": "0.1.0",
+  "description": "Deferred pattern on top of Promise",
+  "main": "lib/node.js",
+  "scripts": {
+    "build": "babel src --presets es2015 --out-dir lib",
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://lolg.it/herby/deferred-lite.git"
+  },
+  "keywords": [
+    "redux",
+    "test"
+  ],
+  "author": "Herbert Vojčík <herby@mailbox.sk>",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://lolg.it/herby/deferred-lite/issues"
+  },
+  "homepage": "https://lolg.it/herby/deferred-lite#readme",
+  "devDependencies": {
+    "babel-cli": "^6.9.0",
+    "babel-preset-es2015": "^6.9.0"
+  }
+}

+ 12 - 0
src/node.js

@@ -0,0 +1,12 @@
+/*
+ * Deferred pattern built on top of Promise.
+ */
+
+export default class Deferred {
+    constructor () {
+        this.promise = new Promise((resolve, reject) => {
+            this.resolve = resolve;
+            this.reject = reject;
+        });
+    }
+}