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

redux-saga-model

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-saga-model - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

65

lib/index.js

@@ -198,6 +198,16 @@ "use strict";

value: function register(model) {
var _this2 = this;
var privateProps = installPrivateProperties[this.__sagaModelKey];
var privatePropsModels = privateProps.models;
if (!Array.isArray(model)) {
model = [model];
}
// push when before getStore
privateProps.models.push(this.checkModel(model, privateProps.models));
model.forEach(function (m) {
privatePropsModels.push(_this2.checkModel(m, privatePropsModels));
});
return this;

@@ -316,3 +326,3 @@ }

* @param {any} unlisteners
* @param {any} m
* @param {any} model
*/

@@ -324,21 +334,30 @@ // inject model dynamically injectModel.bind(this, createReducer,

key: "injectModel",
value: function injectModel(createReducer, onError, unlisteners, m) {
value: function injectModel(createReducer, onError, unlisteners, model) {
var _this3 = this;
var privateProps = installPrivateProperties[this.__sagaModelKey];
m = this.checkModel(m, privateProps.models);
var privatePropsModels = privateProps.models;
var store = privateProps.store;
privateProps.models.push(m);
if (!Array.isArray(model)) {
model = [model];
}
var store = privateProps.store;
model.forEach(function (m) {
m = _this3.checkModel(m, privatePropsModels);
// reducers
store.asyncReducers[m.namespace] = this.getReducer(m.reducers, m.state);
store.replaceReducer(createReducer(store.asyncReducers));
// sagas
if (m.sagas) {
store.runSaga(this.getSaga(m.sagas, m, onError));
}
// subscriptions
if (m.subscriptions) {
unlisteners[m.namespace] = this.runSubscriptions(m.subscriptions, m, onError);
}
privatePropsModels.push(m);
// reducers
store.asyncReducers[m.namespace] = _this3.getReducer(m.reducers, m.state);
store.replaceReducer(createReducer(store.asyncReducers));
// sagas
if (m.sagas) {
store.runSaga(_this3.getSaga(m.sagas, m, onError));
}
// subscriptions
if (m.subscriptions) {
unlisteners[m.namespace] = _this3.runSubscriptions(m.subscriptions, m, onError);
}
});
}

@@ -365,3 +384,3 @@

value: function runSubscriptions(subs, model, onError) {
var _this2 = this;
var _this4 = this;

@@ -377,3 +396,3 @@ var privateProps = installPrivateProperties[this.__sagaModelKey];

var unlistener = sub({
dispatch: _this2.createDispatch(privateProps.store.dispatch, model),
dispatch: _this4.createDispatch(privateProps.store.dispatch, model),
history: privateProps.history

@@ -417,3 +436,3 @@ }, onError);

return _regenerator2.default.mark(function _callee3() {
var _this3 = this;
var _this5 = this;

@@ -479,3 +498,3 @@ var key;

}
}, _callee2, _this3);
}, _callee2, _this5);
})(), "t2", 5);

@@ -498,3 +517,3 @@

value: function createDispatch(dispatch, model) {
var _this4 = this;
var _this6 = this;

@@ -507,3 +526,3 @@ return function (action) {

return dispatch((0, _extends3.default)({}, action, {
type: _this4.prefixType(type, model)
type: _this6.prefixType(type, model)
}));

@@ -510,0 +529,0 @@ };

{
"name": "redux-saga-model",
"version": "0.2.1",
"version": "0.2.2",
"dependencies": {

@@ -5,0 +5,0 @@ "flatten": "^1.0.2",

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