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-19 18:54:48 +00:00
|
|
|
|
|
|
|
import { BoxState, SetBox } from './protocol.js';
|
2021-12-02 23:55:42 +00:00
|
|
|
import { Ref } from '@syndicate-lang/core';
|
2021-01-19 18:54:48 +00:00
|
|
|
|
2021-12-03 00:46:41 +00:00
|
|
|
export function boot(ds: Ref, doneCallback: () => void) {
|
2021-01-19 18:54:48 +00:00
|
|
|
spawn named 'client' {
|
2021-12-02 23:55:42 +00:00
|
|
|
at ds {
|
|
|
|
on asserted BoxState($v: number) => send message SetBox(v + 1);
|
|
|
|
on retracted BoxState(_) => {
|
|
|
|
console.log('box gone');
|
|
|
|
doneCallback();
|
|
|
|
}
|
|
|
|
}
|
2021-01-19 18:54:48 +00:00
|
|
|
}
|
|
|
|
}
|