Detect Changes in PDF Bookmarks
Managing bookmarks from your code or from the bookmarks sidebar UI will trigger events you can listen to. The BookmarksChangeEvent
gets triggered whenever a bookmark is created, updated, or deleted:
instance.addEventListener("bookmarks.change", () => { console.log("Your bookmarks changed!"); });
If you want more information about how exactly a bookmark has changed, there are several other more fine-grained events you can listen to. You’ll find more details about this in the API docs:
-
BookmarksCreateEvent
— Emitted whenever new bookmarks are created. -
BookmarksUpdateEvent
— Emitted whenever bookmarks are updated. -
BookmarksDeleteEvent
— Emitted whenever new bookmarks are deleted. -
BookmarksLoadEvent
— Emitted whenever bookmarks are loaded from the bookmark provider. -
BookmarksWillSaveEvent
andBookmarksDidSaveEvent
— Emitted before and after bookmarks are saved to the bookmark provider.