diff --git a/state-machine/state-machine.d.ts b/state-machine/state-machine.d.ts index 1f5ddb7612..b3f5446531 100644 --- a/state-machine/state-machine.d.ts +++ b/state-machine/state-machine.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Finite State Machine 2.2 +// Type definitions for Finite State Machine 2.3.5 // Project: https://github.com/jakesgordon/javascript-state-machine -// Definitions by: Boris Yankov , Maarten Docter , William Sears +// Definitions by: Boris Yankov , Maarten Docter , William Sears , samael // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface StateMachineErrorCallback { @@ -27,9 +27,13 @@ interface StateMachineConfig { error?: StateMachineErrorCallback; } +interface StateMachineIsFinished { + (state: string): boolean; +} + interface StateMachineStatic { - VERSION: string; // = "2.2.0" + VERSION: string; // = "2.3.5" WILDCARD: string; // = '*' ASYNC: string; // = 'async' @@ -37,7 +41,7 @@ interface StateMachineStatic { SUCCEEDED: number; // = 1, the event transitioned successfully from one state to another NOTRANSITION: number; // = 2, the event was successfull but no state transition was necessary CANCELLED: number; // = 3, the event was cancelled by the caller in a beforeEvent callback - ASYNC: number; // = 4, the event is asynchronous and the caller is in control of when the transition occurs + PENDING: number; // = 4, the event is asynchronous and the caller is in control of when the transition occurs }; Error: { @@ -68,7 +72,7 @@ interface StateMachine { can: StateMachineCan; cannot: StateMachineCan; error: StateMachineErrorCallback; - + isFinished: StateMachineIsFinished; /* transition - only available when performing async state transitions; otherwise null. Can be a: [1] fsm.transition(); // called from async callback [2] fsm.transition.cancel();