Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reshow-flux-base

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reshow-flux-base - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

build/cjs/__tests__/DispatcherTest.js

43

build/cjs/Dispatcher.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc