Sha256: ab934539731bb734ad7ffb3864b354b48d5e2c6001edb9e00e765dcfcaebb9d2

Contents?: true

Size: 1.54 KB

Versions: 14

Compression:

Stored size: 1.54 KB

Contents

Rhomobile.fsm.define("sample FSM", function(/*Rhomobile.fsm.Machine*/fsm){

	fsm.state('Logged out')/*>>state*/
			// to implement the Moore type of FSM
			.immediateTransitsTo('Some state to transit immediately, w/o any input received')/*>>state*/

			.on('login button click')/*>>input*/.transitsTo('Login request sent')/*>>state*/
			.on('timeout happens')/*>>input*/.transitsTo('Screensaver ont')/*>>state*/

			.withEntryAction(/*comment*/'some tags here: and comment text', function()
			{
				// enable login button
			})/*>>state*/

			.withExitAction(/*comment*/'login: disable button', function()
			{
				// disable login button
			})/*>>state*/

			.withActionOnInput(/*inputName*/'login button click', /*comment*/'backlight: turn on', function(input)
			{
				// turn backlight on
			})/*>>state*/

			.withActionOnTransitTo(/*stateName*/'Screensaver on', /*comment*/'backlight: turn off', function(input)
			{
				// turn backlight off
			})/*>>state*/;


	fsm.state('Screensaver on')
			.on('screen touch').transitsTo('Logged out')
			.on('button pressed').transitsTo('Logged out')

			.withEntryAction(/*comment*/'some tags here: and comment text', function(input)
			{
				// turn screensaver on
			})

			.withExitAction(/*comment*/'screensaver: turn off', function(input)
			{
				// turn screensave off
			})

			.withActionOnInput(/*ID*/'button pressed', /*comment*/'commented here', function(input)
			{
			})

			.withActionOnTransitsTo(/*ID*/'Logged out', /*comment*/'commented here', function(input)
			{
			});

}).withInitialState('Logged off');

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rhoconnect-client-7.6.0 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-7.5.1 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-7.4.1 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-7.1.17 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-6.2.0 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-6.0.11 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.18 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.17 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.15 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.0.22 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.2 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.0.7 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.0.3 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js
rhoconnect-client-5.5.0 ./rhoconnect-client/JavaScript/war/js/fsm-sample.js