reshow-flux-base
Advanced tools
Comparing version 0.1.6 to 0.2.0
@@ -10,20 +10,19 @@ "use strict"; | ||
var _classCallCheck2 = _interopRequireDefault(require("reshow-runtime/helpers/classCallCheck")); | ||
var _typeof2 = _interopRequireDefault(require("reshow-runtime/helpers/typeof")); | ||
var _defineProperty2 = _interopRequireDefault(require("reshow-runtime/helpers/defineProperty")); | ||
require("setimmediate"); | ||
var _reshowConstant = require("reshow-constant"); | ||
var Dispatcher = function Dispatcher() { | ||
var _this = this; | ||
var cbs = []; | ||
(0, _classCallCheck2["default"])(this, Dispatcher); | ||
(0, _defineProperty2["default"])(this, "cbs", []); | ||
(0, _defineProperty2["default"])(this, "register", function (cb) { | ||
return _this.cbs.push(cb); | ||
}); | ||
(0, _defineProperty2["default"])(this, "dispatch", function (payload, params) { | ||
if (!payload) { | ||
payload = {}; | ||
} | ||
var register = function register(cb) { | ||
return cbs.push(cb); | ||
}; | ||
if ('string' === typeof payload) { | ||
var dispatch = function dispatch(payload, params) { | ||
payload = payload || {}; | ||
if (_reshowConstant.STRING === (0, _typeof2["default"])(payload)) { | ||
payload = { | ||
@@ -33,12 +32,16 @@ type: payload, | ||
}; | ||
if (!params) { | ||
delete payload.params; | ||
} | ||
!params && delete payload.params; | ||
} | ||
_this.cbs.forEach(function (c) { | ||
return c(payload); | ||
setImmediate(function () { | ||
return cbs.forEach(function (c) { | ||
return c(payload); | ||
}); | ||
}); | ||
}); | ||
}; | ||
return { | ||
register: register, | ||
dispatch: dispatch | ||
}; | ||
}; | ||
@@ -45,0 +48,0 @@ |
@@ -21,5 +21,3 @@ "use strict"; | ||
var Store = | ||
/*#__PURE__*/ | ||
function () { | ||
var Store = /*#__PURE__*/function () { | ||
(0, _createClass2["default"])(Store, [{ | ||
@@ -26,0 +24,0 @@ key: "reduce", |
@@ -1,21 +0,16 @@ | ||
import _classCallCheck from "reshow-runtime/es/helpers/classCallCheck"; | ||
import _defineProperty from "reshow-runtime/es/helpers/defineProperty"; | ||
import _typeof from "reshow-runtime/es/helpers/typeof"; | ||
import "setimmediate"; | ||
import { STRING } from "reshow-constant"; | ||
var Dispatcher = function Dispatcher() { | ||
var _this = this; | ||
var cbs = []; | ||
_classCallCheck(this, Dispatcher); | ||
var register = function register(cb) { | ||
return cbs.push(cb); | ||
}; | ||
_defineProperty(this, "cbs", []); | ||
var dispatch = function dispatch(payload, params) { | ||
payload = payload || {}; | ||
_defineProperty(this, "register", function (cb) { | ||
return _this.cbs.push(cb); | ||
}); | ||
_defineProperty(this, "dispatch", function (payload, params) { | ||
if (!payload) { | ||
payload = {}; | ||
} | ||
if ('string' === typeof payload) { | ||
if (STRING === _typeof(payload)) { | ||
payload = { | ||
@@ -25,14 +20,18 @@ type: payload, | ||
}; | ||
if (!params) { | ||
delete payload.params; | ||
} | ||
!params && delete payload.params; | ||
} | ||
_this.cbs.forEach(function (c) { | ||
return c(payload); | ||
setImmediate(function () { | ||
return cbs.forEach(function (c) { | ||
return c(payload); | ||
}); | ||
}); | ||
}); | ||
}; | ||
return { | ||
register: register, | ||
dispatch: dispatch | ||
}; | ||
}; | ||
export default Dispatcher; |
@@ -7,5 +7,3 @@ import _classCallCheck from "reshow-runtime/es/helpers/classCallCheck"; | ||
var Store = | ||
/*#__PURE__*/ | ||
function () { | ||
var Store = /*#__PURE__*/function () { | ||
_createClass(Store, [{ | ||
@@ -12,0 +10,0 @@ key: "reduce", |
{ | ||
"name": "reshow-flux-base", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"description": "Pure flux dispatch mechanism", | ||
@@ -14,3 +14,5 @@ "main": "./build/cjs/index.js", | ||
"dependencies": { | ||
"reshow-runtime": "*" | ||
"reshow-runtime": "*", | ||
"reshow-constant": "*", | ||
"setimmediate": "*" | ||
}, | ||
@@ -28,5 +30,5 @@ "devDependencies": { | ||
"build:es": "BABEL_ENV=es babel src -d build/es --root-mode upward", | ||
"build:test": "BABEL_ENV=build babel tests -d build/tests --root-mode upward", | ||
"prepublishOnly": "npm run test && npm run build", | ||
"test": "npm run build && npm run build:test && mocha 'build/tests/**/*.js'" | ||
"mocha": "mocha -r jsdom-global/register 'build/cjs/**/__tests__/*.js'", | ||
"test": "npm run build && npm run mocha", | ||
"prepublishOnly": "npm run test && npm run build" | ||
}, | ||
@@ -33,0 +35,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17294
14
485
3
3
+ Addedreshow-constant@*
+ Addedsetimmediate@*
+ Addedsetimmediate@1.0.5(transitive)