Skip To Content

Create a behavior

As a developer, you may want to add functionality to ArcGIS Maps for SharePoint by creating custom behaviors. Behaviors are extensions that execute functionality, but not in response to a particular user interaction (a mouse click, for example). Rather, behaviors are executed in response to some other mechanism; for example, behaviors can be created to respond to events fired by the map, a layer, other tools in the application, or even the hosting system itself.

All behaviors extend the esriMaps/extensions/behaviors/_Behavior base class. Behaviors triggered by events on a specific layer extend the esriMaps/extensions/behaviors/_LayerBehavior class; those triggered by events on the map itself extend the esriMaps/extensions/behaviors/_MapBehavior class. Behaviors triggered by an event on a specific target extend the esriMaps/behaviors/_EventBehavior class.

Create a new behavior

The following example shows the implementation of a behavior that uses a browser's window.console to log the extent of the current map whenever the extent changes. For more information, see the Behavior class documentation in the API reference section.

	function(declare, _MapBehavior) {
    return declare(_MapBehavior, {
        eventName: "extent-change",
        execute: function(delta, extent, levelChange, lod) {
            console.log("Extent changed",, extent);

Add a behavior to ArcGIS Maps for SharePoint

Tools, behaviors, and picture marker sets are packaged in collections named extension packs, which consist of the code files for each extension, any supporting files, and a manifest file that describes the extensions contained within that extension pack. These descriptions, written in JSON format, outline the properties of each extension; for example, a behavior's description must include name and location properties, but it may also include other optional properties.

See Add extensions for more information.