UNPKG

oosmos

Version:

A Hierarchical State Machine Class

41 lines (40 loc) 1.38 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var OOSMOS_1 = require('../OOSMOS'); var TimeoutTest = (function (_super) { __extends(TimeoutTest, _super); function TimeoutTest() { _super.call(this, { DEFAULT: 'A', A: function () { var Count = 0; return { ENTER: function () { Count += 1; this.Print("In state A, Count = " + Count); this.SetTimeoutSeconds(4); }, TIMEOUT: function () { this.Transition('B'); }, }; }, B: { ENTER: function () { this.Print("In state B"); this.SetTimeoutSeconds(1); }, TIMEOUT: function () { this.Transition('A'); }, }, }); } return TimeoutTest; }(OOSMOS_1.StateMachine)); var pTimeoutTest = new TimeoutTest(); pTimeoutTest.SetDebug(true); pTimeoutTest.Start();