Facet.wrap

This commit is contained in:
Tony Garnock-Jones 2024-01-07 13:02:01 +01:00
parent 46bafa9501
commit c9aab425fe
1 changed files with 5 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2023 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { IdentitySet, Value, embeddedId, is, fromJS, stringify, Dictionary, KeyedSet } from '@preserves/core';
import { IdentitySet, Value, embeddedId, is, fromJS, stringify, Dictionary, KeyedSet, Tuple } from '@preserves/core';
import { Cell, Field, Graph } from './dataflow.js';
import { Caveat, runRewrites } from './rewrite.js';
import { ActorSpace } from './space.js';
@ -181,6 +181,10 @@ export class Facet {
this.outbound = initialAssertions;
}
wrap<T extends Tuple<any>>(f: (... args: T) => void): (... args: T) => void {
return (... args) => this.turn(() => f(... args));
}
turn(a: LocalAction) {
Turn.for(this, a);
}