Options
All
  • Public
  • Public/Protected
  • All
Menu

A class representing a snapshot of a document at a certain period of time

Instances of Snapshot get can retrieved from Document.getAllSnapshots or Document.getSnapshotPaginator

Hierarchy

  • BoundEntity<Snapshot, SnapshotEntity, { previewModeChanged: any; restored: any }>
    • Snapshot

Index

Properties

id: string

The ID of the snapshot

documentId: string

The ID of the document the snapshot belongs to

xfdf: string

The XFDF (serialized annotations) for the snapshot

author: User

The author of the snapshot

name: string

The name of the snapshot

document: Document

The [[Document]] the snapshot belongs to

isInPreviewMode: boolean = false

A boolean representing if the snapshot is currently being previewed

createdAt: Date
updatedAt: Date
__type: keyof EntityStateMetadata

Methods

  • preview(): Promise<void>
  • Previews this snapshot in the viewer. Throws an error if the document this snapshot belongs to is not currently in view

    Returns Promise<void>

  • closePreview(): Promise<void>
  • Exits preview mode. If this snapshot is not currently being previews, no action is taken.

    Returns Promise<void>

  • rename(newName: string): Promise<void>
  • Renames the snapshot.

    Throws if the user does not have permission to edit the snapshot.

    Parameters

    • newName: string

    Returns Promise<void>

  • delete(): Promise<void>
  • Deletes the snapshot.

    Throws if the user does not have permission to delete the snapshot

    Returns Promise<void>

  • restore(backupName?: string, withXFDF?: string): Promise<RestoreSnapshot_restoreSnapshot>
  • Restores the document to the state of this snapshot.

    If 'withXfdf' is provided, the document will be restored using the provided XFDF. It is not recommended to use this functionality.

    Throws if user does not have permission to restore a snapshot.

    Parameters

    • Optional backupName: string
    • Optional withXFDF: string

    Returns Promise<RestoreSnapshot_restoreSnapshot>

  • Fired when anything about this snapshot changes

    Parameters

    • event: "onChange"
    • listener: (snapshot: Snapshot) => void

    Returns UnsubscribeFunction

    Returns a function that can be called to unsubscribe from the event

  • Fired when the snapshot is deleted

    Parameters

    • event: "onDestroy"
    • listener: (id: string) => void
        • (id: string): void
        • Parameters

          • id: string

          Returns void

    Returns UnsubscribeFunction

    Returns a function that can be called to unsubscribe from the event

  • Fired when the document is restored to this point in time when this snapshot was taken

    Parameters

    • event: "restored"
    • listener: (snapshot: Snapshot) => void

    Returns UnsubscribeFunction

    Returns a function that can be called to unsubscribe from the event

  • Fired when this snapshot is enters preview mode or leaves preview mode

    Parameters

    • event: "previewModeChanged"
    • listener: (isInPreviewMode: boolean, snapshot: Snapshot) => void
        • (isInPreviewMode: boolean, snapshot: Snapshot): void
        • Parameters

          • isInPreviewMode: boolean
          • snapshot: Snapshot

          Returns void

    Returns UnsubscribeFunction

    Returns a function that can be called to unsubscribe from the event

Generated using TypeDoc