ComPDFKit Web SDK
    Preparing search index...

    Class AnnotationHistoryManager

    Base class for objects that fire named events. Listener arguments are passed by position.

    Hierarchy (View Summary)

    • EventHandler<{ historyChanged: [] }>
      • AnnotationHistoryManager
    Index
    • Adds a listener for an event. Adding the same function twice for one event has no effect.

      Type Parameters

      • K extends "historyChanged"

      Parameters

      • name: K

        Event name.

      • fn: (...args: { historyChanged: [] }[K]) => void

        Listener, called with the event arguments.

      • Optionaloptions: { once?: boolean }

        Listener options.

        • Optionalonce?: boolean

          When true, the listener is removed after it runs once.

      Returns void

    • Starts an explicit batch spanning awaits; repeated calls return the same id. Cannot start while undo / redo is busy.

      Returns string

    • Discards only the records of the current explicit batch; the document and earlier undo / redo stay.

      Returns void

    • Whether there is a step to redo.

      Returns boolean

      True when redo is possible.

    • Whether there is a step to undo.

      Returns boolean

      True when undo is possible.

    • Clears the whole history, including an open batch.

      Returns void

    • Commits the explicit batch as one step; an empty batch is not recorded.

      Returns void

    • The committed history counts; an explicit batch is not counted before end. Each call returns an independent snapshot.

      Returns { canRedo: boolean; canUndo: boolean; redoCount: number; undoCount: number }

      • canRedo: boolean

        Whether there is a step to redo.

      • canUndo: boolean

        Whether there is a step to undo.

      • redoCount: number

        Number of steps that can be redone.

      • undoCount: number

        Number of steps that can be undone.

    • Whether an explicit batch (beginBatchOperation) is in progress.

      Returns boolean

      True while a batch is open.

    • Includes queued requests not yet started; all native entry points share this state.

      Returns boolean

    • Redoes the last undone step. Queued behind pending writes and other undo / redo calls.

      Returns Promise<void>

    • Removes a listener, or every listener of the event when fn is omitted.

      Type Parameters

      • K extends "historyChanged"

      Parameters

      • name: K

        Event name.

      • Optionalfn: (...args: { historyChanged: [] }[K]) => void

        The function that was passed to addEventListener.

      Returns void

    • Maximum number of steps (at least 1); the oldest are dropped when exceeded (setMaxHistorySize).

      Parameters

      • size: number

      Returns void

    • A listener that throws does not affect the others; the error is reported through logger.error.

      Type Parameters

      • K extends "historyChanged"

      Parameters

      • name: K
      • Optionalargs: { historyChanged: [] }[K]

      Returns void

    • Like trigger, but awaits the Promise returned by each listener in turn; a failing listener does not affect the others.

      Type Parameters

      • K extends "historyChanged"

      Parameters

      • name: K
      • Optionalargs: { historyChanged: [] }[K]

      Returns Promise<void>

    • Undoes the last step. Queued behind pending writes and other undo / redo calls.

      Returns Promise<void>

    Events: { HISTORY_CHANGED: "historyChanged" }

    Event names of the history manager.

    Type Declaration

    • ReadonlyHISTORY_CHANGED: "historyChanged"

      'historyChanged': the history changed.