@eclipse-emfcloud/model-manager
Version:
Command-based model editing with undo/redo.
29 lines • 1.33 kB
TypeScript
import { EditingContext } from '../core';
/**
* Utility for execution of async functions that must be given mutually
* exclusive access to some resource. Execution is chained: each async
* call that is passed in for execution is deferred until the previous
* has completed, whether normally or with an error.
*/
export declare class ExclusiveExecutor<K> {
/**
* Awaitable results of the current pending exclusive operations.
* Initially there's nothing pending.
*/
private locks;
/**
* Exclusively run the given asynchronous `operation`, returning its
* eventual result. Operations can be executed in parallel only if they
* affect different models and editing contexts. If modelIds is not
* specified, the operation is assumed to potentially affect any model,
* and will not run in parallel with any other operation.
*
* @param operation an asynchronous operation to run exclusively
* @param contexts the editing contexts affected by the operation
* @param modelIds the identifier of models modified by the operation
* @returns the eventual result of the `operation`
*/
run<T>(operation: () => Promise<T>, contexts: EditingContext[], modelIds?: K[]): Promise<T>;
private getDependentLock;
}
//# sourceMappingURL=promise-util.d.ts.map