syndicate-js/packages/syndicatec/examples/javascript/src/box.js

15 lines
412 B
JavaScript

/// 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 = 0;
assert BoxState(this.value);
stop on (this.value === N)
console.log('terminated box root facet');
on message SetBox($v) => this.value = v;
}
}