The Events namespace contains all the event types that can be used with the
addEventListener() method. These events provide a comprehensive way to monitor
and respond to changes within the PDF viewer.
Example
// Listen for view state changes instance.addEventListener("viewState.change", (viewState, previousViewState) => { console.log("View state changed:", viewState.toJS()); });
Each event has a corresponding event listener type that defines the expected function signature.
These types ensure type safety when registering event listeners and provide clear
documentation of the parameters each event listener receives.
Event Lifecycle
Many events follow a lifecycle pattern:
Will events: Fired before an action occurs, allowing you to prevent it
The
Eventsnamespace contains all the event types that can be used with theaddEventListener()method. These events provide a comprehensive way to monitor and respond to changes within the PDF viewer.Example
Event Handler Types
Each event has a corresponding event listener type that defines the expected function signature. These types ensure type safety when registering event listeners and provide clear documentation of the parameters each event listener receives.
Event Lifecycle
Many events follow a lifecycle pattern:
For example, with annotations:
annotations.willSave→annotations.change→annotations.didSave