# OpenLayers.Strategy.Save

A strategy that commits newly created or modified features. By default the strategy waits for a call to save before persisting changes. By configuring the strategy with the auto option, changes can be saved automatically.

#### Inherits from

- OpenLayers.Strategy

Summary

OpenLayers.Strategy.Save | A strategy that commits newly created or modified features.
Properties |
events | {OpenLayers.Events} An events object that handles all events on the strategy object.
events | {OpenLayers.Events} Events instance for triggering this protocol events.
auto | {Boolean | Number} Auto-save.
timer | {Number} The id of the timer.
Constructor |
OpenLayers.Strategy.Save | Create a new Save strategy.
Functions |
activate | Activate the strategy.
deactivate | Deactivate the strategy.
triggerSave | Registered as a listener.
save | Tell the layer protocol to commit unsaved features.
onCommit | Called after protocol commit.

### Properties

### events

{OpenLayers.Events} An events object that handles all events on the strategy object.

#### Register a listener for a particular event with the following syntax

>     strategy.events.register(type, obj, listener);

#### Supported event types

start | Triggered before saving
success | Triggered after a successful transaction
fail | Triggered after a failed transaction

### events

{OpenLayers.Events} Events instance for triggering this protocol events.

### auto

{Boolean | Number} Auto-save. Default is false. If true, features will be saved immediately after being added to the layer and with each modification or deletion. If auto is a number, features will be saved on an interval provided by the value (in seconds).

### timer

{Number} The id of the timer.

### Constructor

### OpenLayers.Strategy.Save

Create a new Save strategy.

#### Parameters

options | {Object} Optional object whose properties will be set on the instance.

### Functions

### activate

> activate: function()

Activate the strategy. Register any listeners, do appropriate setup.

#### Returns

{Boolean} The strategy was successfully activated.

### deactivate

> deactivate: function()

Deactivate the strategy. Unregister any listeners, do appropriate tear-down.

#### Returns

{Boolean} The strategy was successfully deactivated.

### triggerSave

> triggerSave: function( | event | )

Registered as a listener. Calls save if a feature has insert, update, or delete state.

#### Parameters

event | {Object} The event this function is listening for.

### save

> save: function( | features | )

Tell the layer protocol to commit unsaved features. If the layer projection differs from the map projection, features will be transformed into the layer projection before being committed.

#### Parameters

features | {Array} Features to be saved. If null, then default is all features in the layer. Features are assumed to be in the map projection.

### onCommit

> onCommit: function( | response | )

Called after protocol commit.

#### Parameters

response | {OpenLayers.Protocol.Response} A response object.

> activate: function()

Activate the strategy.

> deactivate: function()

Deactivate the strategy.

> triggerSave: function( | event | )

Registered as a listener.

> save: function( | features | )

Tell the layer protocol to commit unsaved features.

> onCommit: function( | response | )

Called after protocol commit.
{Boolean | Number} Auto-save.
Abstract vector layer strategy class.
Protocols return Response objects to their users.
Close