Options
All
  • Public
  • Public/Protected
  • All
Menu

A global event manager that can be used to subscribe to events that happen during the Collaboration flow.

Can be accessed via CollabClient.EventManager

example
import { CollabClient } from '@pdftron/collab-client'

const client = new CollabClient({
...options
})

const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
// event handling code
})

// Unsubscribe from the event when needed
unsubscribe()

Hierarchy

  • BoundClass<{ documentLoaded: typeof __type; documentChanged: typeof __type; documentDeleted: typeof __type; annotationAdded: typeof __type; annotationChanged: typeof __type; annotationDeleted: typeof __type; annotationMarkedAsRead: typeof __type; snapshotAdded: typeof __type; snapshotChanged: typeof __type; snapshotDeleted: typeof __type; snapshotRestored: typeof __type; userLoggedIn: typeof __type; userLoggedOut: typeof __type; inviteReceived: typeof __type; mentionAdded: typeof __type; mentionDeleted: typeof __type; enteredPreviewMode: typeof __type; exitedPreviewMode: typeof __type; annotationSizeError: typeof __type; connectedUsersChanged: typeof __type; scrollSyncSessionsChanged: typeof __type; joinedScrollSyncSession: typeof __type; leftScrollSyncSession: typeof __type; annotationPermissionError: typeof __type; documentPermissionError: typeof __type; snapshotPermissionError: typeof __type }>
    • EventManager

Index

Methods

Methods

  • Fired any time a document is loaded in the viewer

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "documentLoaded"
    • listener: (document: Document) => void

    Returns UnsubscribeFunction

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

  • Fired any time a document entity is updated. This includes new/edited/deleted annotations and members

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "documentChanged"
    • listener: (document: Document) => void

    Returns UnsubscribeFunction

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

  • Fired when a document is deleted

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "documentDeleted"
    • listener: (documentId: string) => void
        • (documentId: string): void
        • Parameters

          • documentId: string

          Returns void

    Returns UnsubscribeFunction

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

  • Fired any time an annotation is added

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    Returns UnsubscribeFunction

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

  • Fired any time an annotation is changed

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    Returns UnsubscribeFunction

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

  • Fired any time an annotation is deleted

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "annotationDeleted"
    • listener: (annotationId: string) => void
        • (annotationId: string): void
        • Parameters

          • annotationId: string

          Returns void

    Returns UnsubscribeFunction

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

  • Fired any time an annotation is marked as read for the current user

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    Returns UnsubscribeFunction

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

  • Fired any time a snapshot is created of the document the user is viewing

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

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

    Returns UnsubscribeFunction

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

  • Fired any time a snapshot of a document is edited

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

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

    Returns UnsubscribeFunction

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

  • Fired any time a snapshot of a document is deleted

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "snapshotDeleted"
    • listener: (snapshotId: string) => void
        • (snapshotId: string): void
        • Parameters

          • snapshotId: string

          Returns void

    Returns UnsubscribeFunction

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

  • Fired any time a document is restored to a snapshot state.

    The second parameter is a function that you can call to sync the users viewer with the updated annotations.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "snapshotRestored"
    • listener: (snapshot: Snapshot, syncViewer: () => Promise<void>) => void
        • (snapshot: Snapshot, syncViewer: () => Promise<void>): void
        • Parameters

          • snapshot: Snapshot
          • syncViewer: () => Promise<void>
              • (): Promise<void>
              • Returns Promise<void>

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when the user is successfully logged in

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "userLoggedIn"
    • listener: (user: User) => void
        • Parameters

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when the user the user is logged out

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "userLoggedOut"
    • listener: () => void
        • (): void
        • Returns void

    Returns UnsubscribeFunction

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

  • Fired when the current user receives an invite to a document

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    Returns UnsubscribeFunction

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

  • Fired any time the current user is mentioned in a comment

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "mentionAdded"
    • listener: (mention: Mention) => void

    Returns UnsubscribeFunction

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

  • Fired any time a mention of the current user is deleted

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "mentionDeleted"
    • listener: (mentionId: string) => void
        • (mentionId: string): void
        • Parameters

          • mentionId: string

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when the viewer goes into preview mode. See Snapshot for more information.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

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

    Returns UnsubscribeFunction

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

  • Fired when the viewer leaves preview mode. See Snapshot for more information.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

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

    Returns UnsubscribeFunction

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

  • Fired when an annotation is created that exceeds to maximum allowed annotation size (see CollabClientOptions.maxAnnotationSize)

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "annotationSizeError"
    • listener: (annot: Annotation) => void
        • (annot: Annotation): void
        • Parameters

          • annot: Annotation

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when a scroll sync session is created, ended, or a new document is loaded and the available sessions changes

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    Returns UnsubscribeFunction

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

  • Fired when the user joins a scroll sync session

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    Returns UnsubscribeFunction

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

  • Fired when the user leaves a scroll sync session, or the scroll sync session is ended by the host

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "leftScrollSyncSession"
    • listener: (sessionId: string) => void
        • (sessionId: string): void
        • Parameters

          • sessionId: string

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when a user connects or disconnects from the current document, or when the page a user is looking at is updated. Only triggered if CollabClientOptions.enableConnectedUsers is set.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "connectedUsersChanged"
    • listener: (users: User[], document: Document, action: ChangeEventTypes) => void
        • (users: User[], document: Document, action: ChangeEventTypes): void
        • Parameters

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when a user tried to perform an annotation action but does not have permission to do so.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "annotationPermissionError"
    • listener: (action: "ADD" | "DELETE" | "MODIFY" | "READ", annotation?: Annotation) => void
        • (action: "ADD" | "DELETE" | "MODIFY" | "READ", annotation?: Annotation): void
        • Parameters

          • action: "ADD" | "DELETE" | "MODIFY" | "READ"
          • Optional annotation: Annotation

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when a user tried to perform a document action but does not have permission to do so.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "documentPermissionError"
    • listener: (action: "INVITE" | "ADD" | "DELETE" | "MODIFY" | "READ", document?: Document) => void
        • (action: "INVITE" | "ADD" | "DELETE" | "MODIFY" | "READ", document?: Document): void
        • Parameters

          • action: "INVITE" | "ADD" | "DELETE" | "MODIFY" | "READ"
          • Optional document: Document

          Returns void

    Returns UnsubscribeFunction

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

  • Fired when a user tried to perform a snapshot action but does not have permission to do so.

    example
    import { CollabClient } from '@pdftron/collab-client'

    const client = new CollabClient({
    ...options
    })

    const unsubscribe = client.EventManager.subscribe('EVENT_NAME_HERE', () => {
    // event handling code
    })

    // Unsubscribe from the event when needed
    unsubscribe()

    Parameters

    • event: "snapshotPermissionError"
    • listener: (action: "DELETE" | "MODIFY" | "READ" | "CREATE" | "RESTORE", snapshot?: Snapshot) => void
        • (action: "DELETE" | "MODIFY" | "READ" | "CREATE" | "RESTORE", snapshot?: Snapshot): void
        • Parameters

          • action: "DELETE" | "MODIFY" | "READ" | "CREATE" | "RESTORE"
          • Optional snapshot: Snapshot

          Returns void

    Returns UnsubscribeFunction

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

Generated using TypeDoc