reshow-flux-base
Advanced tools
Comparing version 0.17.40 to 0.17.41
@@ -31,2 +31,3 @@ "use strict"; | ||
* @template StateType | ||
* @template ActionType | ||
* @interface | ||
@@ -41,5 +42,5 @@ */ | ||
(0, _defineProperty2["default"])(this, "getState", void 0); | ||
/** @type {emiter<StateType>["add"]} */ | ||
/** @type {emiter<StateType, ActionType>["add"]} */ | ||
(0, _defineProperty2["default"])(this, "addListener", void 0); | ||
/** @type {emiter<StateType>["remove"]} */ | ||
/** @type {emiter<StateType, ActionType>["remove"]} */ | ||
(0, _defineProperty2["default"])(this, "removeListener", void 0); | ||
@@ -53,26 +54,36 @@ }); | ||
* @template StateType | ||
* @typedef {string|boolean|null|ActionObject|Payload|function(State<StateType>):ActionObject} DispatchAction | ||
* @template ActionType | ||
* @typedef {string|boolean|null|ActionObject|Payload|function(State<StateType>):ActionType} DispatchAction | ||
*/ | ||
/** | ||
* @typedef {function(State<any>?, ActionObject?, State<any>?):State<any>} FluxHandler | ||
* @template StateType | ||
* @template ActionType | ||
* @typedef {function(State<StateType>?, ActionType?, State<any>?):State<any>} FluxHandler | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterResetCall | ||
* @returns {FluxHandler[]} | ||
* @returns {FluxHandler<StateType, ActionType>[]} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterAddCall | ||
* @param {FluxHandler} handler | ||
* @param {FluxHandler<StateType, ActionType>} handler | ||
* @returns {number} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterRemoveCall | ||
* @param {FluxHandler} handler | ||
* @returns {FluxHandler[]} | ||
* @param {FluxHandler<StateType, ActionType>} handler | ||
* @returns {FluxHandler<StateType, ActionType>[]} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterEmitCall | ||
* @param {State<StateType>} state | ||
* @param {ActionObject} action | ||
* @param {ActionType} action | ||
* @param {State<StateType>} prevState | ||
@@ -82,2 +93,3 @@ */ | ||
* @template StateType | ||
* @template ActionType | ||
* @interface | ||
@@ -88,9 +100,9 @@ */ | ||
(0, _classCallCheck2["default"])(this, emiter); | ||
/** @type {EmitterResetCall} */ | ||
/** @type {EmitterResetCall<StateType, ActionType>} */ | ||
(0, _defineProperty2["default"])(this, "reset", void 0); | ||
/** @type {EmitterAddCall} */ | ||
/** @type {EmitterAddCall<StateType, ActionType>} */ | ||
(0, _defineProperty2["default"])(this, "add", void 0); | ||
/** @type {EmitterRemoveCall} */ | ||
/** @type {EmitterRemoveCall<StateType, ActionType>} */ | ||
(0, _defineProperty2["default"])(this, "remove", void 0); | ||
/** @type {EmitterEmitCall<StateType>} */ | ||
/** @type {EmitterEmitCall<StateType, ActionType>} */ | ||
(0, _defineProperty2["default"])(this, "emit", void 0); | ||
@@ -100,7 +112,8 @@ }); | ||
* @template StateType | ||
* @returns emiter | ||
* @template ActionType | ||
* @returns emiter<StateType, ActionType> | ||
*/ | ||
var getMitt = function getMitt() { | ||
/** | ||
* @type FluxHandler[] | ||
* @type FluxHandler<StateType, ActionType>[] | ||
*/ | ||
@@ -110,3 +123,3 @@ var pool = []; | ||
/** | ||
* @type EmitterResetCall | ||
* @type EmitterResetCall<StateType, ActionType> | ||
*/ | ||
@@ -117,3 +130,3 @@ reset: function reset() { | ||
/** | ||
* @type EmitterAddCall | ||
* @type EmitterAddCall<StateType, ActionType> | ||
*/ | ||
@@ -125,3 +138,3 @@ add: function add(handler) { | ||
* >>> 0 for change indexOf return -1 to 4294967295 | ||
* @type EmitterRemoveCall | ||
* @type EmitterRemoveCall<StateType, ActionType> | ||
*/ | ||
@@ -132,3 +145,3 @@ remove: function remove(handler) { | ||
/** | ||
* @type EmitterEmitCall<StateType> | ||
* @type EmitterEmitCall<StateType, ActionType> | ||
*/ | ||
@@ -152,6 +165,7 @@ emit: function emit(state, action, prevState) { | ||
* @template StateType | ||
* @param {DispatchAction<StateType>} action | ||
* @template ActionType | ||
* @param {DispatchAction<StateType, ActionType>} action | ||
* @param {Payload} [params] | ||
* @param {State<StateType>} [prevState] | ||
* @returns {ActionObject} lazy actions | ||
* @returns {ActionType} lazy actions | ||
*/ | ||
@@ -178,3 +192,6 @@ var refineAction = function refineAction(action, params, prevState) { | ||
* @template ActionType | ||
* @typedef {function(State<StateType>, ActionObject|ActionType): State<any>} ReducerType | ||
* @callback ReducerType | ||
* @param {State<StateType>} StateArg | ||
* @param {ActionType} ActionArg | ||
* @returns {State<any>} | ||
*/ | ||
@@ -184,4 +201,5 @@ | ||
* @template StateType | ||
* @template ActionType | ||
* @callback DispatchType | ||
* @param {DispatchAction<StateType>} action | ||
* @param {DispatchAction<StateType, ActionType>} action | ||
* @param {Payload} [actionParams] | ||
@@ -196,3 +214,3 @@ * @returns {State<StateType>} endingState | ||
* @param {InitStateType<StateType>} [initState] | ||
* @returns {[StoreObject<StateType>, DispatchType<StateType>]} | ||
* @returns {[StoreObject<StateType>, DispatchType<StateType, ActionType>]} | ||
*/ | ||
@@ -206,3 +224,3 @@ exports.refineAction = refineAction; | ||
/** | ||
* @type {DispatchType<StateType>} | ||
* @type {DispatchType<StateType, ActionType>} | ||
*/ | ||
@@ -209,0 +227,0 @@ var dispatch = function dispatch(action, actionParams) { |
{ | ||
"version": "0.17.40", | ||
"version": "0.17.41", | ||
"name": "reshow-flux-base", | ||
@@ -4,0 +4,0 @@ "repository": { |
@@ -19,5 +19,6 @@ /** | ||
* @template StateType | ||
* @template ActionType | ||
* @interface | ||
*/ | ||
export class StoreObject<StateType> { | ||
export class StoreObject<StateType, ActionType> { | ||
/** @type {function():State<StateType>} */ | ||
@@ -27,8 +28,8 @@ reset: () => State<StateType>; | ||
getState: () => State<StateType>; | ||
/** @type {emiter<StateType>["add"]} */ | ||
addListener: emiter<StateType>["add"]; | ||
/** @type {emiter<StateType>["remove"]} */ | ||
removeListener: emiter<StateType>["remove"]; | ||
/** @type {emiter<StateType, ActionType>["add"]} */ | ||
addListener: emiter<StateType, ActionType>["add"]; | ||
/** @type {emiter<StateType, ActionType>["remove"]} */ | ||
removeListener: emiter<StateType, ActionType>["remove"]; | ||
} | ||
export function refineAction<StateType>(action: DispatchAction<StateType>, params?: Payload, prevState?: StateType): ActionObject; | ||
export function refineAction<StateType, ActionType>(action: DispatchAction<StateType, ActionType>, params?: Payload, prevState?: StateType): ActionType; | ||
export default createReducer; | ||
@@ -40,10 +41,10 @@ export type State<StateType> = StateType; | ||
export type InitStateType<StateType> = State<StateType> | (() => State<StateType>); | ||
export type DispatchAction<StateType> = string | boolean | null | ActionObject | Payload | ((arg0: State<StateType>) => ActionObject); | ||
export type FluxHandler = (arg0: State<any> | null, arg1: ActionObject | null, arg2: State<any> | null) => State<any>; | ||
export type EmitterResetCall = () => FluxHandler[]; | ||
export type EmitterAddCall = (handler: FluxHandler) => number; | ||
export type EmitterRemoveCall = (handler: FluxHandler) => FluxHandler[]; | ||
export type EmitterEmitCall<StateType> = (state: State<StateType>, action: ActionObject, prevState: State<StateType>) => any; | ||
export type ReducerType<StateType, ActionType> = (arg0: State<StateType>, arg1: ActionObject | ActionType) => State<any>; | ||
export type DispatchType<StateType> = (action: DispatchAction<StateType>, actionParams?: Payload) => State<StateType>; | ||
export type DispatchAction<StateType, ActionType> = string | boolean | null | ActionObject | Payload | ((arg0: State<StateType>) => ActionType); | ||
export type FluxHandler<StateType, ActionType> = (arg0: State<StateType> | null, arg1: ActionType | null, arg2: State<any> | null) => State<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: State<StateType>, action: ActionType, prevState: State<StateType>) => any; | ||
export type ReducerType<StateType, ActionType> = (StateArg: State<StateType>, ActionArg: ActionType) => State<any>; | ||
export type DispatchType<StateType, ActionType> = (action: DispatchAction<StateType, ActionType>, actionParams?: Payload) => State<StateType>; | ||
/** | ||
@@ -55,26 +56,36 @@ * @template StateType | ||
* @template StateType | ||
* @typedef {string|boolean|null|ActionObject|Payload|function(State<StateType>):ActionObject} DispatchAction | ||
* @template ActionType | ||
* @typedef {string|boolean|null|ActionObject|Payload|function(State<StateType>):ActionType} DispatchAction | ||
*/ | ||
/** | ||
* @typedef {function(State<any>?, ActionObject?, State<any>?):State<any>} FluxHandler | ||
* @template StateType | ||
* @template ActionType | ||
* @typedef {function(State<StateType>?, ActionType?, State<any>?):State<any>} FluxHandler | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterResetCall | ||
* @returns {FluxHandler[]} | ||
* @returns {FluxHandler<StateType, ActionType>[]} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterAddCall | ||
* @param {FluxHandler} handler | ||
* @param {FluxHandler<StateType, ActionType>} handler | ||
* @returns {number} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterRemoveCall | ||
* @param {FluxHandler} handler | ||
* @returns {FluxHandler[]} | ||
* @param {FluxHandler<StateType, ActionType>} handler | ||
* @returns {FluxHandler<StateType, ActionType>[]} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback EmitterEmitCall | ||
* @param {State<StateType>} state | ||
* @param {ActionObject} action | ||
* @param {ActionType} action | ||
* @param {State<StateType>} prevState | ||
@@ -84,13 +95,14 @@ */ | ||
* @template StateType | ||
* @template ActionType | ||
* @interface | ||
*/ | ||
declare class emiter<StateType> { | ||
/** @type {EmitterResetCall} */ | ||
reset: EmitterResetCall; | ||
/** @type {EmitterAddCall} */ | ||
add: EmitterAddCall; | ||
/** @type {EmitterRemoveCall} */ | ||
remove: EmitterRemoveCall; | ||
/** @type {EmitterEmitCall<StateType>} */ | ||
emit: EmitterEmitCall<StateType>; | ||
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>; | ||
} | ||
@@ -100,8 +112,12 @@ /** | ||
* @template ActionType | ||
* @typedef {function(State<StateType>, ActionObject|ActionType): State<any>} ReducerType | ||
* @callback ReducerType | ||
* @param {State<StateType>} StateArg | ||
* @param {ActionType} ActionArg | ||
* @returns {State<any>} | ||
*/ | ||
/** | ||
* @template StateType | ||
* @template ActionType | ||
* @callback DispatchType | ||
* @param {DispatchAction<StateType>} action | ||
* @param {DispatchAction<StateType, ActionType>} action | ||
* @param {Payload} [actionParams] | ||
@@ -115,4 +131,4 @@ * @returns {State<StateType>} endingState | ||
* @param {InitStateType<StateType>} [initState] | ||
* @returns {[StoreObject<StateType>, DispatchType<StateType>]} | ||
* @returns {[StoreObject<StateType>, DispatchType<StateType, ActionType>]} | ||
*/ | ||
declare function createReducer<StateType, ActionType>(reducer: ReducerType<StateType, ActionType>, initState?: InitStateType<StateType>): [StoreObject<StateType>, DispatchType<StateType>]; | ||
declare function createReducer<StateType, ActionType>(reducer: ReducerType<StateType, ActionType>, initState?: InitStateType<StateType>): [StoreObject<StateType, any>, DispatchType<StateType, ActionType>]; |
export { default as SimpleMap } from "./SimpleMap"; | ||
export type InitStateType<StateType> = import("./createReducer").InitStateType<StateType>; | ||
export type ReducerType<StateType, ActionType> = import("./createReducer").ReducerType<StateType, ActionType>; | ||
export type DispatchType<StateType> = import("./createReducer").DispatchType<StateType>; | ||
export type DispatchType<StateType, ActionType> = import("./createReducer").DispatchType<StateType, ActionType>; | ||
export { default as createReducer, refineAction, StoreObject, ActionObject } from "./createReducer"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
35352
1079