Skip to content

@graphty/graphty-element / index / OperationQueueManager

Class: OperationQueueManager ​

Defined in: graphty-element/src/managers/OperationQueueManager.ts:79

Manages a queue of graph operations with dependency resolution and batching Ensures operations execute in the correct order based on their dependencies

Implements ​

Constructors ​

Constructor ​

new OperationQueueManager(eventManager, options?): OperationQueueManager

Defined in: graphty-element/src/managers/OperationQueueManager.ts:182

Creates a new operation queue manager

Parameters ​

eventManager ​

EventManager

Event manager for emitting operation events

options? ​

Queue configuration options

autoStart? ​

boolean

Whether to auto-start the queue (default: true)

concurrency? ​

number

Maximum concurrent operations (default: 1)

interval? ​

number

Time interval in milliseconds

intervalCap? ​

number

Maximum operations per interval

Returns ​

OperationQueueManager

Properties ​

hasLayoutEngine? ​

optional hasLayoutEngine?: () => boolean

Defined in: graphty-element/src/managers/OperationQueueManager.ts:119

Returns ​

boolean


onOperationQueued? ​

optional onOperationQueued?: (category, description?) => void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:116

Parameters ​

category ​

OperationCategory

description? ​

string

Returns ​

void

Methods ​

cancelByCategory() ​

cancelByCategory(category): number

Defined in: graphty-element/src/managers/OperationQueueManager.ts:1041

Cancel all operations of a specific category

Parameters ​

category ​

OperationCategory

The operation category to cancel

Returns ​

number

Number of operations cancelled


cancelOperation() ​

cancelOperation(operationId): boolean

Defined in: graphty-element/src/managers/OperationQueueManager.ts:999

Cancel a specific operation

Parameters ​

operationId ​

string

ID of the operation to cancel

Returns ​

boolean

True if the operation was cancelled, false otherwise


clear() ​

clear(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:846

Clear all pending operations

Returns ​

void


clearCategoryCompleted() ​

clearCategoryCompleted(category): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:1032

Clear completed status for a category This is useful when a category needs to be re-executed (e.g., setStyleTemplate is called explicitly, overriding initial styles)

Parameters ​

category ​

OperationCategory

The operation category to clear

Returns ​

void


disableBatching() ​

disableBatching(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:871

Disable batching (execute operations immediately)

Returns ​

void


dispose() ​

dispose(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:234

Dispose the operation queue and cancel all active operations

Returns ​

void

Implementation of ​

Manager.dispose


enableBatching() ​

enableBatching(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:878

Enable batching to group operations before execution

Returns ​

void


enterBatchMode() ​

enterBatchMode(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:887

Enter batch mode - operations will be queued but not executed

Returns ​

void


exitBatchMode() ​

exitBatchMode(): Promise<void>

Defined in: graphty-element/src/managers/OperationQueueManager.ts:895

Exit batch mode - execute all batched operations in dependency order

Returns ​

Promise<void>


getActiveOperations() ​

getActiveOperations(): string[]

Defined in: graphty-element/src/managers/OperationQueueManager.ts:1069

Get all active operation IDs

Returns ​

string[]

Array of active operation IDs


getOperationController() ​

getOperationController(operationId): AbortController | undefined

Defined in: graphty-element/src/managers/OperationQueueManager.ts:990

Get the AbortController for a specific operation

Parameters ​

operationId ​

string

ID of the operation

Returns ​

AbortController | undefined

The AbortController or undefined if not found


getOperationProgress() ​

getOperationProgress(operationId): OperationProgress | undefined

Defined in: graphty-element/src/managers/OperationQueueManager.ts:1061

Get current progress for an operation

Parameters ​

operationId ​

string

ID of the operation

Returns ​

OperationProgress | undefined

Progress information or undefined if not found


getStats() ​

getStats(): object

Defined in: graphty-element/src/managers/OperationQueueManager.ts:817

Get queue statistics

Returns ​

object

Current queue state including pending operations, size, and pause status

isPaused ​

isPaused: boolean

pending ​

pending: number

size ​

size: number


init() ​

init(): Promise<void>

Defined in: graphty-element/src/managers/OperationQueueManager.ts:227

Initialize the operation queue manager

Returns ​

Promise<void>

Implementation of ​

Manager.init


isInBatchMode() ​

isInBatchMode(): boolean

Defined in: graphty-element/src/managers/OperationQueueManager.ts:927

Check if currently in batch mode

Returns ​

boolean

True if in batch mode, false otherwise


markCategoryCompleted() ​

markCategoryCompleted(category): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:1022

Mark a category as completed (for satisfying cross-batch dependencies) This is useful when a category's requirements are met through other means (e.g., style-init is satisfied by constructor initialization)

Parameters ​

category ​

OperationCategory

The operation category to mark as completed

Returns ​

void


pause() ​

pause(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:832

Pause/resume queue execution

Returns ​

void


queueOperation() ​

queueOperation(category, execute, options?): string

Defined in: graphty-element/src/managers/OperationQueueManager.ts:260

Queue an operation for execution Returns the operation ID

Parameters ​

category ​

OperationCategory

Category of the operation

execute ​

(context) => void | Promise<void>

Function to execute for this operation

options? ​

Partial<OperationMetadata>

Optional metadata for the operation

Returns ​

string

The unique operation ID


queueOperationAsync() ​

queueOperationAsync(category, execute, options?): Promise<void>

Defined in: graphty-element/src/managers/OperationQueueManager.ts:939

Queue an operation and get a promise for its completion Used for batch mode operations

Parameters ​

category ​

OperationCategory

Category of the operation

execute ​

(context) => void | Promise<void>

Function to execute for this operation

options? ​

Partial<OperationMetadata>

Optional metadata for the operation

Returns ​

Promise<void>

Promise that resolves when the operation completes


registerTrigger() ​

registerTrigger(category, trigger): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:1078

Register a custom trigger for a specific operation category

Parameters ​

category ​

OperationCategory

Operation category to trigger on

trigger ​

(metadata?) => { category: OperationCategory; description?: string; execute: (context) => void | Promise<void>; } | null

Function that returns trigger configuration or null

Returns ​

void


resume() ​

resume(): void

Defined in: graphty-element/src/managers/OperationQueueManager.ts:839

Resume queue execution after being paused

Returns ​

void


settled() ​

settled(): Promise<void>

Defined in: graphty-element/src/managers/OperationQueueManager.ts:809

Resolve once nothing is queued or running.

The same wait as OperationQueueManager.waitForCompletion, under the name the session's queue contract uses. Both exist so that this manager satisfies RunQueue STRUCTURALLY, with no cast and no adapter: the session must be able to talk to the renderer's queue without importing it, which is the whole reason that contract is shaped the way it is.

Returns ​

Promise<void>

A promise that resolves when the queue is idle.


waitForCompletion() ​

waitForCompletion(): Promise<void>

Defined in: graphty-element/src/managers/OperationQueueManager.ts:789

Wait for all queued operations to complete

Returns ​

Promise<void>