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

15 lines
454 B
TypeScript

/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
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;
}
}