Connect canonical projects to persistent workspace runtimes and canvas views
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
/** A captured pointer may only finish the exact interaction that acquired it. */
|
||||
export type EditingLease<T> = { preview(value: T): void; commit(): void; cancel(): void };
|
||||
|
||||
export function guardEditingLease<T>(isCurrent: () => boolean, actions: EditingLease<T>): EditingLease<T> {
|
||||
return Object.freeze({
|
||||
preview(value: T) { if (isCurrent()) actions.preview(value); },
|
||||
commit() { if (isCurrent()) actions.commit(); },
|
||||
cancel() { if (isCurrent()) actions.cancel(); },
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user