Skip to content

@graphty/graphty-element / managers / OperationQueueManager

Class: OperationQueueManager ​

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

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:145

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:93

Returns ​

boolean


onOperationQueued()? ​

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

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

Parameters ​

category ​

OperationCategory

description? ​

string

Returns ​

void

Methods ​

cancelByCategory() ​

cancelByCategory(category): number

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

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:865

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:721

Clear all pending operations

Returns ​

void


clearCategoryCompleted() ​

clearCategoryCompleted(category): void

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

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:743

Disable batching (execute operations immediately)

Returns ​

void


dispose() ​

dispose(): void

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

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:750

Enable batching to group operations before execution

Returns ​

void


enterBatchMode() ​

enterBatchMode(): void

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

Enter batch mode - operations will be queued but not executed

Returns ​

void


exitBatchMode() ​

exitBatchMode(): Promise<void>

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

Exit batch mode - execute all batched operations in dependency order

Returns ​

Promise<void>


getActiveOperations() ​

getActiveOperations(): string[]

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

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:856

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:927

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:692

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:190

Initialize the operation queue manager

Returns ​

Promise<void>

Implementation of ​

Manager.init


isInBatchMode() ​

isInBatchMode(): boolean

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

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:888

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:707

Pause/resume queue execution

Returns ​

void


queueOperation() ​

queueOperation(category, execute, options?): string

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

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:811

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:944

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:714

Resume queue execution after being paused

Returns ​

void


waitForCompletion() ​

waitForCompletion(): Promise<void>

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

Wait for all queued operations to complete

Returns ​

Promise<void>