New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

clean-state

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-state - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

2

index.d.ts

@@ -61,2 +61,4 @@ export interface Module {

export type Plugin = (modules: any, on: any) => void;
export const mixin: <C extends Module, M extends Record<string, Module>>(

@@ -63,0 +65,0 @@ common: C,

import { useEffect, useCallback, useState } from 'react';
import EventEmitter from 'eventemitter3';
import Container from './container';
var DISPATCH_TYPE = Symbol('CS_DISPATCH');
var plugins = [];
var bootstrap = function (modules) {
var container = new Container(modules);
var pluginEmitter = new EventEmitter();
var dispatch = function (nameAndMethod, payload) {

@@ -11,2 +15,6 @@ var _a = nameAndMethod.split('/'), namespace = _a[0], methodName = _a[1];

if (effects[methodName]) {
pluginEmitter.emit(DISPATCH_TYPE, {
type: nameAndMethod,
payload: payload
});
return effects[methodName]({ state: state, payload: payload, rootState: rootState, dispatch: dispatch });

@@ -18,5 +26,10 @@ }

rootState: rootState,
payload: payload
});
container.setState(namespace, newState);
pluginEmitter.emit(DISPATCH_TYPE, {
type: nameAndMethod,
payload: payload,
newState: newState
});
container.setState(namespace, newState);
}

@@ -51,4 +64,9 @@ };

injectFns(rootEffects);
plugins.forEach(function (plugin) { return plugin(modules, pluginEmitter.on); });
return { useModule: useModule, dispatch: dispatch };
};
bootstrap.addPlugin = function (plugin) {
plugins.push(plugin);
};
bootstrap.DISPATCH_TYPE = DISPATCH_TYPE;
export default bootstrap;

2

lib/container.js

@@ -28,3 +28,3 @@ import EventEmitter from 'eventemitter3';

reducers: _this.rootReducers[k],
effects: _this.rootEffects[k],
effects: _this.rootEffects[k]
};

@@ -31,0 +31,0 @@ Object.assign(combineModule, (_a = {}, _a[k] = module, _a));

{
"name": "clean-state",
"version": "2.1.2",
"version": "2.1.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -29,2 +29,3 @@ <p align="right">

7. TypeScript friendly and automatically deduces module types.
8. Perfect support for RN.

@@ -79,2 +80,6 @@ ## Installation

function App() {
/**
* Here you can also pass in an array and return multiple module states at the same time
* const {user, project} = useModule(['user', 'project'])
*/
const { user } = useModule('user')

@@ -81,0 +86,0 @@ const onChange = useCallback((e)=> {

{
"compilerOptions": {
"target": "es5",
"target": "es3",
"module": "esnext",

@@ -5,0 +5,0 @@ "moduleResolution": "node",

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