Comparing version 0.2.17 to 0.2.18
@@ -41,6 +41,6 @@ declare module 'robot3' { | ||
*/ | ||
export function transition<C>( | ||
export function transition<C, E>( | ||
event: string, | ||
state: string, | ||
...args: (Reducer<C> | Guard<C> | Action<C>)[] | ||
...args: (Reducer<C, E> | Guard<C, E> | Action<C, E>)[] | ||
): Transition | ||
@@ -55,5 +55,5 @@ | ||
*/ | ||
export function immediate<C>( | ||
export function immediate<C, E>( | ||
state: string, | ||
...args: (Reducer<C> | Guard<C>)[] | ||
...args: (Reducer<C, E> | Guard<C, E>)[] | ||
): Transition | ||
@@ -65,5 +65,5 @@ | ||
* | ||
* @param guardFunction A Function that can receive *context* and will return true or false. | ||
* @param guardFunction A Function that can receive *context* and *event* and will return true or false. | ||
*/ | ||
export function guard<C>(guardFunction?: GuardFunction<C>): Guard<C> | ||
export function guard<C, E>(guardFunction?: GuardFunction<C, E>): Guard<C, E> | ||
@@ -75,3 +75,3 @@ /** | ||
*/ | ||
export function reduce<C>(reduceFunction?: ReduceFunction<C>): Reducer<C> | ||
export function reduce<C, E>(reduceFunction?: ReduceFunction<C, E>): Reducer<C, E> | ||
@@ -81,5 +81,5 @@ /** | ||
* | ||
* @param actionFunction A Function that can receive *context*, returned values are discarded. | ||
* @param actionFunction A Function that can receive *context* and *event*. Returned values are discarded. | ||
*/ | ||
export function action<C>(actionFunction?: ActionFunction<C>): Action<C> | ||
export function action<C, E>(actionFunction?: ActionFunction<C, E>): Action<C, E> | ||
@@ -105,9 +105,9 @@ /** | ||
export type ContextFunction<T> = (context: T, event: unknown) => T | ||
export type ContextFunction<T> = (initialContext: T) => any | ||
export type GuardFunction<T> = (context: T, event: unknown) => boolean | ||
export type GuardFunction<C, E> = (context: C, event: E) => boolean | ||
export type ActionFunction<T> = (context: T, event: unknown) => boolean | ||
export type ActionFunction<C, E> = (context: C, event: E) => unknown | ||
export type ReduceFunction<T> = (context: T, event: unknown) => T | ||
export type ReduceFunction<C, E> = (context: C, event: E) => C | ||
@@ -131,12 +131,12 @@ export type InterpretOnChangeFunction<T extends Machine> = ( | ||
export type Action<C> = { | ||
fn: (context: C) => void | ||
export type Action<C, E> = { | ||
fn: ActionFunction<C, E> | ||
} | ||
export type Reducer<C> = { | ||
fn: (context: C, event: unknown) => C | ||
export type Reducer<C, E> = { | ||
fn: ReduceFunction<C, E> | ||
} | ||
export type Guard<C> = { | ||
fn: (context: C) => boolean | ||
export type Guard<C, E> = { | ||
fn: GuardFunction<C, E> | ||
} | ||
@@ -143,0 +143,0 @@ |
{ | ||
"name": "robot3", | ||
"version": "0.2.17", | ||
"version": "0.2.18", | ||
"description": "A function, immutable Finite State Machine library", | ||
@@ -5,0 +5,0 @@ "main": "dist/machine.js", |
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
22215