Skip to content

Commit

Permalink
Check in new dists
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Jan 25, 2016
1 parent b885115 commit 5038ebc
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 321 deletions.
Binary file modified dist/TypeState.1.0.1.nupkg
Binary file not shown.
148 changes: 74 additions & 74 deletions dist/typestate-1.0.1.d.ts
@@ -1,105 +1,105 @@
declare module TypeState {
/**
* Transition grouping to faciliate fluent api
* @class Transitions<T>
*/
* Transition grouping to faciliate fluent api
* @class Transitions<T>
*/
class Transitions<T> {
public fsm: FiniteStateMachine<T>;
fsm: FiniteStateMachine<T>;
constructor(fsm: FiniteStateMachine<T>);
public fromStates: T[];
public toStates: T[];
fromStates: T[];
toStates: T[];
/**
* Specify the end state(s) of a transition function
* @method to
* @param ...states {T[]}
*/
public to(...states: T[]): void;
public toAny(states: any): void;
* Specify the end state(s) of a transition function
* @method to
* @param ...states {T[]}
*/
to(...states: T[]): void;
toAny(states: any): void;
}
/**
* Internal representation of a transition function
* @class TransitionFunction<T>
*/
* Internal representation of a transition function
* @class TransitionFunction<T>
*/
class TransitionFunction<T> {
public fsm: FiniteStateMachine<T>;
public from: T;
public to: T;
fsm: FiniteStateMachine<T>;
from: T;
to: T;
constructor(fsm: FiniteStateMachine<T>, from: T, to: T);
}
/***
* A simple finite state machine implemented in TypeScript, the templated argument is meant to be used
* with an enumeration.
* @class FiniteStateMachine<T>
*/
* A simple finite state machine implemented in TypeScript, the templated argument is meant to be used
* with an enumeration.
* @class FiniteStateMachine<T>
*/
class FiniteStateMachine<T> {
public currentState: T;
currentState: T;
private _startState;
private _transitionFunctions;
private _onCallbacks;
private _exitCallbacks;
private _enterCallbacks;
/**
* @constructor
* @param startState {T} Intial starting state
*/
* @constructor
* @param startState {T} Intial starting state
*/
constructor(startState: T);
public addTransitions(fcn: Transitions<T>): void;
addTransitions(fcn: Transitions<T>): void;
/**
* Listen for the transition to this state and fire the associated callback
* @method on
* @param state {T} State to listen to
* @param callback {fcn} Callback to fire
*/
public on(state: T, callback: (from?: T) => any): FiniteStateMachine<T>;
* Listen for the transition to this state and fire the associated callback
* @method on
* @param state {T} State to listen to
* @param callback {fcn} Callback to fire
*/
on(state: T, callback: (from?: T) => any): FiniteStateMachine<T>;
/**
* Listen for the transition to this state and fire the associated callback, returning
* false in the callback will block the transition to this state.
* @method on
* @param state {T} State to listen to
* @param callback {fcn} Callback to fire
*/
public onEnter(state: T, callback: (from?: T) => boolean): FiniteStateMachine<T>;
* Listen for the transition to this state and fire the associated callback, returning
* false in the callback will block the transition to this state.
* @method on
* @param state {T} State to listen to
* @param callback {fcn} Callback to fire
*/
onEnter(state: T, callback: (from?: T) => boolean): FiniteStateMachine<T>;
/**
* Listen for the transition to this state and fire the associated callback, returning
* false in the callback will block the transition from this state.
* @method on
* @param state {T} State to listen to
* @param callback {fcn} Callback to fire
*/
public onExit(state: T, callback: (to?: T) => boolean): FiniteStateMachine<T>;
* Listen for the transition to this state and fire the associated callback, returning
* false in the callback will block the transition from this state.
* @method on
* @param state {T} State to listen to
* @param callback {fcn} Callback to fire
*/
onExit(state: T, callback: (to?: T) => boolean): FiniteStateMachine<T>;
/**
* Declares the start state(s) of a transition function, must be followed with a '.to(...endStates)'
* @method from
* @param ...states {T[]}
*/
public from(...states: T[]): Transitions<T>;
public fromAny(states: any): Transitions<T>;
* Declares the start state(s) of a transition function, must be followed with a '.to(...endStates)'
* @method from
* @param ...states {T[]}
*/
from(...states: T[]): Transitions<T>;
fromAny(states: any): Transitions<T>;
private _validTransition(from, to);
/**
* Check whether a transition to a new state is valide
* @method canGo
* @param state {T}
*/
public canGo(state: T): boolean;
* Check whether a transition to a new state is valide
* @method canGo
* @param state {T}
*/
canGo(state: T): boolean;
/**
* Transition to another valid state
* @method go
* @param state {T}
*/
public go(state: T): void;
* Transition to another valid state
* @method go
* @param state {T}
*/
go(state: T): void;
/**
* This method is availble for overridding for the sake of extensibility.
* It is called in the event of a successful transition.
* @method onTransition
* @param from {T}
* @param to {T}
*/
public onTransition(from: T, to: T): void;
* This method is availble for overridding for the sake of extensibility.
* It is called in the event of a successful transition.
* @method onTransition
* @param from {T}
* @param to {T}
*/
onTransition(from: T, to: T): void;
/**
* Reset the finite state machine back to the start state, DO NOT USE THIS AS A SHORTCUT for a transition. This is for starting the fsm from the beginning.
* @method reset
*/
public reset(): void;
* Reset the finite state machine back to the start state, DO NOT USE THIS AS A SHORTCUT for a transition. This is for starting the fsm from the beginning.
* @method reset
*/
reset(): void;
private _transitionTo(state);
}
}

0 comments on commit 5038ebc

Please sign in to comment.