syndicate-js/packages/ts-plugin/examples/typescript/src/box.ts

15 lines
454 B
TypeScript
Raw Normal View History

2021-12-01 16:24:29 +00:00
/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
2021-01-23 22:38:00 +00:00
import { BoxState, SetBox, N } from './protocol.js';
boot {
spawn named 'box' {
field value: number = 0;
assert BoxState(this.value);
stop on (this.value === N)
console.log('terminated box root facet');
on message SetBox($v: number) => this.value = v;
}
}