tsc package

This commit is contained in:
Tony Garnock-Jones 2021-12-03 01:52:46 +01:00
parent fb420855e9
commit 7b9f035fa8
6 changed files with 30 additions and 20 deletions

View File

@ -7,7 +7,4 @@
<h1>Look in the JavaScript console for output.</h1> <h1>Look in the JavaScript console for output.</h1>
<main id="main"> <main id="main">
</main> </main>
<script>
Syndicate.bootModule(Main.__SYNDICATE__bootProc);
</script>
</html> </html>

View File

@ -2,13 +2,17 @@
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com> /// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { BoxState, SetBox, N } from './protocol.js'; import { BoxState, SetBox, N } from './protocol.js';
import { Ref } from '@syndicate-lang/core';
boot { export function boot(ds: Ref) {
spawn named 'box' { spawn named 'box' {
field value: number = 0; field boxValue: number = 0;
assert BoxState(this.value); at ds {
stop on (this.value === N) assert BoxState(boxValue.value);
on message SetBox($v: number) => boxValue.value = v;
}
stop on (boxValue.value === N) {
console.log('terminated box root facet'); console.log('terminated box root facet');
on message SetBox($v: number) => this.value = v; }
} }
} }

View File

@ -2,10 +2,16 @@
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com> /// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { BoxState, SetBox } from './protocol.js'; import { BoxState, SetBox } from './protocol.js';
import { Ref } from '@syndicate-lang/core';
boot { export function boot(ds: Ref, doneCallback: () => void) {
spawn named 'client' { spawn named 'client' {
on asserted BoxState($v: number) => send message SetBox(v + 1); at ds {
on retracted BoxState(_) => console.log('box gone'); on asserted BoxState($v: number) => send message SetBox(v + 1);
on retracted BoxState(_) => {
console.log('box gone');
doneCallback();
}
}
} }
} }

View File

@ -2,11 +2,14 @@
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com> /// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { N } from './protocol.js'; import { N } from './protocol.js';
activate import './box.js'; import * as Box from './box.js';
activate import './client.js'; import * as Client from './client.js';
import { Actor, Dataspace, Turn } from '@syndicate-lang/core';
console.time('box-and-client-' + N.toString()); console.time('box-and-client-' + N.toString());
boot { Actor.boot(() => {
thisFacet.actor.dataspace.ground().addStopHandler(() => Turn.activeFacet.preventInertCheck();
console.timeEnd('box-and-client-' + N.toString())); const ds = create new Dataspace();
} Box.boot(ds);
Client.boot(ds, () => console.timeEnd('box-and-client-' + N.toString()));
});

View File

@ -1,7 +1,7 @@
/// SPDX-License-Identifier: GPL-3.0-or-later /// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com> /// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
export assertion type BoxState(value); export assertion type BoxState(value: number);
export message type SetBox(newValue); export message type SetBox(newValue: number);
export const N = 100000; export const N = 100000;

View File

@ -163,7 +163,7 @@ function runBuildOnce(options: CommandLineArguments, toWatch = new ToWatch()) {
return sf; return sf;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
onError?.(e.message); onError?.((e as any).message ?? '<no error message available>');
return undefined; return undefined;
} }
} else { } else {