tsc package
This commit is contained in:
parent
fb420855e9
commit
7b9f035fa8
|
@ -7,7 +7,4 @@
|
|||
<h1>Look in the JavaScript console for output.</h1>
|
||||
<main id="main">
|
||||
</main>
|
||||
<script>
|
||||
Syndicate.bootModule(Main.__SYNDICATE__bootProc);
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -2,13 +2,17 @@
|
|||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
|
||||
import { BoxState, SetBox, N } from './protocol.js';
|
||||
import { Ref } from '@syndicate-lang/core';
|
||||
|
||||
boot {
|
||||
export function boot(ds: Ref) {
|
||||
spawn named 'box' {
|
||||
field value: number = 0;
|
||||
assert BoxState(this.value);
|
||||
stop on (this.value === N)
|
||||
field boxValue: number = 0;
|
||||
at ds {
|
||||
assert BoxState(boxValue.value);
|
||||
on message SetBox($v: number) => boxValue.value = v;
|
||||
}
|
||||
stop on (boxValue.value === N) {
|
||||
console.log('terminated box root facet');
|
||||
on message SetBox($v: number) => this.value = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,16 @@
|
|||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
|
||||
import { BoxState, SetBox } from './protocol.js';
|
||||
import { Ref } from '@syndicate-lang/core';
|
||||
|
||||
boot {
|
||||
export function boot(ds: Ref, doneCallback: () => void) {
|
||||
spawn named 'client' {
|
||||
on asserted BoxState($v: number) => send message SetBox(v + 1);
|
||||
on retracted BoxState(_) => console.log('box gone');
|
||||
at ds {
|
||||
on asserted BoxState($v: number) => send message SetBox(v + 1);
|
||||
on retracted BoxState(_) => {
|
||||
console.log('box gone');
|
||||
doneCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
|
||||
import { N } from './protocol.js';
|
||||
activate import './box.js';
|
||||
activate import './client.js';
|
||||
import * as Box from './box.js';
|
||||
import * as Client from './client.js';
|
||||
import { Actor, Dataspace, Turn } from '@syndicate-lang/core';
|
||||
|
||||
console.time('box-and-client-' + N.toString());
|
||||
boot {
|
||||
thisFacet.actor.dataspace.ground().addStopHandler(() =>
|
||||
console.timeEnd('box-and-client-' + N.toString()));
|
||||
}
|
||||
Actor.boot(() => {
|
||||
Turn.activeFacet.preventInertCheck();
|
||||
const ds = create new Dataspace();
|
||||
Box.boot(ds);
|
||||
Client.boot(ds, () => console.timeEnd('box-and-client-' + N.toString()));
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
||||
|
||||
export assertion type BoxState(value);
|
||||
export message type SetBox(newValue);
|
||||
export assertion type BoxState(value: number);
|
||||
export message type SetBox(newValue: number);
|
||||
|
||||
export const N = 100000;
|
||||
|
|
|
@ -163,7 +163,7 @@ function runBuildOnce(options: CommandLineArguments, toWatch = new ToWatch()) {
|
|||
return sf;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
onError?.(e.message);
|
||||
onError?.((e as any).message ?? '<no error message available>');
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue