I am trying to store bookmarks on the client local-storage but I can't seem to intercept the following events on the bookmark widget or on the BookmarkViewModel class [on Create, Update, Delete]. I would like to use the bookmark widget for its UI. Any idea?
Bookmarks | ArcGIS API for JavaScript 4.14
BookmarksViewModel | ArcGIS API for JavaScript 4.14
Thanks
Solved! Go to Solution.
You can listen for the bookmarks collections change event. You'll want to wait until the webmap is ready so the bookmarks are populated. Here's an example: https://codepen.io/kellyhutchins/pen/ExjPGQe
You can listen for the bookmarks collections change event. You'll want to wait until the webmap is ready so the bookmarks are populated. Here's an example: https://codepen.io/kellyhutchins/pen/ExjPGQe
Thank you Kelly,
The "Add", and "Remove" event works great! I was able to capture those two events. then what about when the bookmark's name gets updated? I was looking for an event like "updated". I am wondering if I can watch for the property name change using watchUtils | ArcGIS API for JavaScript 4.14 ?
Thank you
Yep looks like you'd want to watch the name property.
bookmarkWidget.bookmarks.forEach(function (bookmark) {
bookmark.watch("name", function (name) {
console.log("Name Changed", name);
});
});