Socket
Socket
Sign inDemoInstall

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.17.43 to 0.17.44

build/cjs/src/type.js

111

build/cjs/src/createReducer.js

@@ -5,43 +5,18 @@ "use strict";

exports.__esModule = true;
exports.refineAction = exports["default"] = exports.StoreObject = exports.ActionObject = void 0;
var _createClass2 = _interopRequireDefault(require("reshow-runtime/helpers/createClass"));
var _classCallCheck2 = _interopRequireDefault(require("reshow-runtime/helpers/classCallCheck"));
var _defineProperty2 = _interopRequireDefault(require("reshow-runtime/helpers/defineProperty"));
exports.refineAction = exports["default"] = void 0;
var _callFunc = _interopRequireDefault(require("call-func"));
var _reshowConstant = require("reshow-constant");
var _type = require("./type.js");
// @ts-check
/**
* @typedef {Object.<string, any>} Payload
*/
/**
* @interface
*/
var ActionObject = /*#__PURE__*/(0, _createClass2["default"])(function ActionObject() {
(0, _classCallCheck2["default"])(this, ActionObject);
/** @type {string=} */
(0, _defineProperty2["default"])(this, "type", void 0);
/** @type {Payload=} */
(0, _defineProperty2["default"])(this, "params", void 0);
});
/**
* @template StateType
* @template ActionType
* @interface
* @typedef {import('./type').FluxHandler<StateType, ActionType>} FluxHandler
*/
exports.ActionObject = ActionObject;
var StoreObject = /*#__PURE__*/(0, _createClass2["default"])(function StoreObject() {
(0, _classCallCheck2["default"])(this, StoreObject);
/** @type {function():StateType} */
(0, _defineProperty2["default"])(this, "reset", void 0);
/** @type {function():StateType} */
(0, _defineProperty2["default"])(this, "getState", void 0);
/** @type {emiter<StateType, ActionType>["add"]} */
(0, _defineProperty2["default"])(this, "addListener", void 0);
/** @type {emiter<StateType, ActionType>["remove"]} */
(0, _defineProperty2["default"])(this, "removeListener", void 0);
});
/**
* @template StateType
* @typedef {StateType|function():StateType} InitStateType
* @typedef {import('./type').Payload} Payload
*/
/**

@@ -54,2 +29,3 @@ * @template StateType

*/
/**

@@ -63,58 +39,4 @@ * @template StateType

* @template ActionType
* @callback FluxHandler
* @param {StateType} NextState
* @param {ActionType} Action
* @param {StateType} PrevState
* @returns{any}
* @returns Emiter<StateType, ActionType>
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterResetCall
* @returns {FluxHandler<StateType, ActionType>[]}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterAddCall
* @param {FluxHandler<StateType, ActionType>} handler
* @returns {number}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterRemoveCall
* @param {FluxHandler<StateType, ActionType>} handler
* @returns {FluxHandler<StateType, ActionType>[]}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterEmitCall
* @param {StateType} state
* @param {ActionType} action
* @param {StateType} prevState
*/
/**
* @template StateType
* @template ActionType
* @interface
*/
exports.StoreObject = StoreObject;
var emiter = /*#__PURE__*/(0, _createClass2["default"])(function emiter() {
(0, _classCallCheck2["default"])(this, emiter);
/** @type {EmitterResetCall<StateType, ActionType>} */
(0, _defineProperty2["default"])(this, "reset", void 0);
/** @type {EmitterAddCall<StateType, ActionType>} */
(0, _defineProperty2["default"])(this, "add", void 0);
/** @type {EmitterRemoveCall<StateType, ActionType>} */
(0, _defineProperty2["default"])(this, "remove", void 0);
/** @type {EmitterEmitCall<StateType, ActionType>} */
(0, _defineProperty2["default"])(this, "emit", void 0);
});
/**
* @template StateType
* @template ActionType
* @returns emiter<StateType, ActionType>
*/
var getMitt = function getMitt() {

@@ -127,3 +49,3 @@ /**

/**
* @type EmitterResetCall<StateType, ActionType>
* @type Emiter['reset']<StateType, ActionType>
*/

@@ -134,3 +56,3 @@ reset: function reset() {

/**
* @type EmitterAddCall<StateType, ActionType>
* @type Emiter['add']<StateType, ActionType>
*/

@@ -142,3 +64,3 @@ add: function add(handler) {

* >>> 0 for change indexOf return -1 to 4294967295
* @type EmitterRemoveCall<StateType, ActionType>
* @type Emiter['remove']<StateType, ActionType>
*/

@@ -149,3 +71,3 @@ remove: function remove(handler) {

/**
* @type EmitterEmitCall<StateType, ActionType>
* @type Emiter['emit']<StateType, ActionType>
*/

@@ -198,3 +120,3 @@ emit: function emit(state, action, prevState) {

* @param {ActionType} ActionArg
* @returns {any}
* @returns {StateType}
*/

@@ -204,2 +126,7 @@

* @template StateType
* @typedef {StateType|function():StateType} InitStateType
*/
/**
* @template StateType
* @template ActionType

@@ -206,0 +133,0 @@ * @callback DispatchType

@@ -10,5 +10,6 @@ "use strict";

exports.refineAction = _createReducer.refineAction;
exports.StoreObject = _createReducer.StoreObject;
exports.ActionObject = _createReducer.ActionObject;
var _type = require("./type.js");
exports.StoreObject = _type.StoreObject;
exports.ActionObject = _type.ActionObject;
var _SimpleMap = _interopRequireDefault(require("./SimpleMap.js"));
exports.SimpleMap = _SimpleMap["default"];
{
"version": "0.17.43",
"version": "0.17.44",
"name": "reshow-flux-base",

@@ -4,0 +4,0 @@ "repository": {

@@ -1,58 +0,21 @@

/**
* @typedef {Object.<string, any>} Payload
*/
/**
* @interface
*/
export class ActionObject {
/** @type {string=} */
type: string | undefined;
/** @type {Payload=} */
params: Payload | undefined;
}
/**
* @template StateType
* @template ActionType
* @interface
*/
export class StoreObject<StateType, ActionType> {
/** @type {function():StateType} */
reset: () => StateType;
/** @type {function():StateType} */
getState: () => StateType;
/** @type {emiter<StateType, ActionType>["add"]} */
addListener: emiter<StateType, ActionType>["add"];
/** @type {emiter<StateType, ActionType>["remove"]} */
removeListener: emiter<StateType, ActionType>["remove"];
}
export function refineAction<StateType, ActionType>(action: DispatchAction<StateType, ActionType>, params?: Payload, prevState?: StateType): ActionType;
export default createReducer;
export type Payload = {
[x: string]: any;
};
export type InitStateType<StateType> = StateType | (() => StateType);
export type FluxHandler<StateType, ActionType> = import('./type').FluxHandler<StateType, ActionType>;
export type Payload = import('./type').Payload;
export type DispatchCallback<StateType, ActionType> = (State: StateType) => ActionType;
export type DispatchAction<StateType, ActionType> = ActionType | DispatchCallback<StateType, ActionType>;
export type FluxHandler<StateType, ActionType> = (NextState: StateType, Action: ActionType, PrevState: StateType) => any;
export type EmitterResetCall<StateType, ActionType> = () => FluxHandler<StateType, ActionType>[];
export type EmitterAddCall<StateType, ActionType> = (handler: FluxHandler<StateType, ActionType>) => number;
export type EmitterRemoveCall<StateType, ActionType> = (handler: FluxHandler<StateType, ActionType>) => FluxHandler<StateType, ActionType>[];
export type EmitterEmitCall<StateType, ActionType> = (state: StateType, action: ActionType, prevState: StateType) => any;
export type ReducerType<StateType, ActionType> = (StateArg: StateType, ActionArg: ActionType) => any;
export type ReducerType<StateType, ActionType> = (StateArg: StateType, ActionArg: ActionType) => StateType;
export type InitStateType<StateType> = StateType | (() => StateType);
export type DispatchType<StateType, ActionType> = (action: DispatchAction<StateType, ActionType>, actionParams?: Payload) => StateType;
/**
* @template StateType
* @typedef {StateType|function():StateType} InitStateType
*/
/**
* @template StateType
* @template ActionType
* @callback DispatchCallback
* @param {StateType} State
* @returns {ActionType}
* @callback ReducerType
* @param {StateType} StateArg
* @param {ActionType} ActionArg
* @returns {StateType}
*/
/**
* @template StateType
* @template ActionType
* @typedef {ActionType|DispatchCallback<StateType, ActionType>} DispatchAction
* @typedef {StateType|function():StateType} InitStateType
*/

@@ -62,62 +25,2 @@ /**

* @template ActionType
* @callback FluxHandler
* @param {StateType} NextState
* @param {ActionType} Action
* @param {StateType} PrevState
* @returns{any}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterResetCall
* @returns {FluxHandler<StateType, ActionType>[]}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterAddCall
* @param {FluxHandler<StateType, ActionType>} handler
* @returns {number}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterRemoveCall
* @param {FluxHandler<StateType, ActionType>} handler
* @returns {FluxHandler<StateType, ActionType>[]}
*/
/**
* @template StateType
* @template ActionType
* @callback EmitterEmitCall
* @param {StateType} state
* @param {ActionType} action
* @param {StateType} prevState
*/
/**
* @template StateType
* @template ActionType
* @interface
*/
declare class emiter<StateType, ActionType> {
/** @type {EmitterResetCall<StateType, ActionType>} */
reset: EmitterResetCall<StateType, ActionType>;
/** @type {EmitterAddCall<StateType, ActionType>} */
add: EmitterAddCall<StateType, ActionType>;
/** @type {EmitterRemoveCall<StateType, ActionType>} */
remove: EmitterRemoveCall<StateType, ActionType>;
/** @type {EmitterEmitCall<StateType, ActionType>} */
emit: EmitterEmitCall<StateType, ActionType>;
}
/**
* @template StateType
* @template ActionType
* @callback ReducerType
* @param {StateType} StateArg
* @param {ActionType} ActionArg
* @returns {any}
*/
/**
* @template StateType
* @template ActionType
* @callback DispatchType

@@ -136,1 +39,2 @@ * @param {DispatchAction<StateType, ActionType>} action

declare function createReducer<StateType, ActionType>(reducer: ReducerType<StateType, ActionType>, initState?: InitStateType<StateType>): [StoreObject<StateType, ActionType>, DispatchType<StateType, ActionType>];
import { StoreObject } from "./type";

@@ -5,2 +5,3 @@ export { default as SimpleMap } from "./SimpleMap";

export type DispatchType<StateType, ActionType> = import("./createReducer").DispatchType<StateType, ActionType>;
export { default as createReducer, refineAction, StoreObject, ActionObject } from "./createReducer";
export { default as createReducer, refineAction } from "./createReducer";
export { StoreObject, ActionObject } from "./type";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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