hexstate

State machine written in Haxe
https://github.com/DoclerLabs/hexState

This is not the latest stable version of hexstate. See version 0.35.0 for the latest version.

To install, run:

haxelib install hexstate 0.17.0 

See using Haxelib in Haxelib documentation for more information.

README.md

hexState TravisCI Build Status

State machine written in Haxe

Find more information about hexMachina on hexmachina.org

Dependencies

Simple example

// MessageTypes
this.logAsUser 			= new MessageType( "onLogin" );
this.logAsGuest 		= new MessageType( "onLogAsGuest" );
this.logout 			= new MessageType( "onLogout" );
this.logAsAdministrator = new MessageType( "onLogAsAdministrator" );

// States
this.anonymous 		= new State( "anonymous" );
this.guest 			= new State( "guest" );
this.user 			= new State( "user" );
this.administrator 	= new State( "administrator" );
	
this._stateMachine 	= new StateMachine( this.anonymous );
this._controller 	= new StateController( this._injector, this._stateMachine );

this.anonymous.addEnterCommand( DeleteAllCookiesMockCommand );
this.anonymous.addEnterCommand( DisplayAddBannerMockCommand );
this.anonymous.addTransition( this.logAsUser, this.user );
this.anonymous.addTransition( this.logAsGuest, this.guest );

this.user.addEnterCommand( PrepareUserInfosMockCommand );
this.user.addEnterCommand( DisplayWelcomeMessageMockCommand );
this.user.addExitCommand( StoreUserActivityMockCommand );
this.user.addTransition( this.logAsAdministrator, this.administrator );

this.guest.addEnterCommand( DisplayAddBannerMockCommand );
this.guest.addEnterCommand( InviteForRegisterMockCommand );
this.guest.addTransition( this.logAsUser, this.user );
this.guest.addTransition( this.logout, this.anonymous );

this.administrator.addEnterCommand( GetAdminPrivilegesMockCommand );
this.administrator.addExitCommand( RemoveAdminPrivilegesMockCommand );

this._stateMachine.addResetMessageType( [ this.logout ] );
Contributors
doclerlabs
Version
0.17.0
Published
1 year ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github