Allow startup without explicit limit/report parameters

This commit is contained in:
Tony Garnock-Jones 2021-03-04 11:29:04 +01:00
parent ade26bd283
commit 01fb3a471a
1 changed files with 6 additions and 3 deletions

View File

@ -1,12 +1,15 @@
import { BoxState, SetBox } from "./box-protocol.js";
import { Handle, Ref, Turn } from "./actor.js";
import { Assertion, Handle, Ref, Turn } from "./actor.js";
import { Observe } from "./dataspace.js";
let startTime = Date.now();
let prevValue = 0;
export default function (t: Turn, [ds, LIMIT, REPORT_EVERY]: [Ref, number, number]) {
console.log('Spawning Box');
export default function (t: Turn, arg: Assertion) {
const [ds, LIMIT, REPORT_EVERY]: [Ref, number, number] = Array.isArray(arg) && arg.length === 3
? arg as any
: [arg, 50000, 2500];
console.log('Spawning Box', LIMIT, REPORT_EVERY);
let valueHandle: Handle | undefined;
function setValue(t: Turn, value: number) {
valueHandle = t.replace(ds, valueHandle, BoxState(value));