Skip To ContentArcGIS for DevelopersSign In Dashboard
require(["esri/widgets/Bookmarks/BookmarksViewModel"], function(BookmarksViewModel) { /* code goes here */ });
Class: esri/widgets/Bookmarks/BookmarksViewModel
Inheritance: BookmarksViewModel Accessor
Since: ArcGIS API for JavaScript 4.8

Provides the logic for the Bookmarks widget.

See also:

Constructors

new BookmarksViewModel(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
Bookmark

The Bookmark that is being navigated to.

more details
more detailsBookmarksViewModel
Collection<Bookmark>

A collection of Bookmarks.

more details
more detailsBookmarksViewModel
String

The name of the class.

more details
more detailsAccessor
GoToOverride

This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.

more details
more detailsBookmarksViewModel
String

The view model's state.

more details
more detailsBookmarksViewModel
MapView

The view from which the widget will operate.

more details
more detailsBookmarksViewModel

Property Details

activeBookmark Bookmarkreadonly
Since: ArcGIS API for JavaScript 4.9

The Bookmark that is being navigated to.

bookmarks Collection<Bookmark>

A collection of Bookmarks.

declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

goToOverride GoToOverride

This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.

See also:
Example:
// The following snippet uses the Search widget but can be applied to any
// widgets that support the goToOverride property.
search.goToOverride = function(view, goToParams) {
  goToParams.options.duration = updatedDuration;
  return view.goTo(goToParams.target, goToParams.options);
};
state Stringreadonly

The view model's state.

Possible Values:"loading"|"ready"

Default Value:ready
view MapView

The view from which the widget will operate.

Method Overview

NameReturn TypeSummaryClass
Promise<Bookmark>

Creates a new bookmark from based on the BookmarkCreationOptions.

more details
more detailsBookmarksViewModel
Promise

Zoom to a specific bookmark.

more details
more detailsBookmarksViewModel

Method Details

createBookmark(bookmarkCreationOptions){Promise<Bookmark>}
Since: ArcGIS API for JavaScript 4.13

Creates a new bookmark from based on the BookmarkCreationOptions.

Parameter:
bookmarkCreationOptions BookmarkCreationOptions
optional

Specifies how new bookmarks will be created. Can be used to enable/disable taking screenshots or capturing the extent when a new bookmark is added.

Returns:
TypeDescription
Promise<Bookmark>When resolved, returns the newly created Bookmark.
Example:
// Creates new bookmark from current view extent
viewModel.createBookmark().then(function(bookmark){
   // Give the bookmark a name
   bookmark.name = "New Bookmark";
   // Add to bookmarks list
   viewModel.bookmarks.add(bookmark);
});
goTo(Bookmark){Promise}

Zoom to a specific bookmark.

Parameter:
Bookmark Bookmark

The bookmark to zoom to.

Returns:
TypeDescription
PromiseResolves after the animation to specified bookmark finishes.

Type Definitions

BookmarkCreationOptions Object

Specifies how new bookmarks will be created.

Properties:
takeScreenshot Boolean
optional

Indicates whether a screenshot is taken when a new bookmark is created. The screenshot will be set as the thumbnail in the newly created bookmark. Default is true.

captureExtent Boolean
optional

Indicates whether the extent of the current view will become the extent of a newly created bookmark. Default is true.

screenshotSettings Object
optional

An object that specifies the settings of the screenshot that will be used to create the bookmark's thumbnail.

Specification:
width Number
optional

The width (in pixels) of the screenshot. Default is 128px.

height Number
optional

The height (in pixels) of the screenshot. Default is 128px.

area Object
optional

Used to take a screenshot of a subregion of the view. Defaults to the whole view.

Specification:
optional

The x value of the screenshot area.

optional

The y value of the screenshot area.

width Number
optional

The width of the screenshot area.

height Number
optional

The height of the screenshot area.

layers Layer[]
optional

An optional list of layers to be included in the screenshot.

API Reference search results

NameTypeModule
Loading...