added comments for offlineFeaturesManager

This commit is contained in:
andygup 2014-02-20 16:08:29 -07:00
parent f107486aea
commit 9c37c84529

View File

@ -31,6 +31,11 @@ define([
ALL_EDITS_SENT: 'all-edits-sent' // ...after going online and there are no pending edits in the queue
},
/**
* Overrides a feature layer.
* @param layer
* @returns deferred
*/
extend: function(layer)
{
var self = this;
@ -41,6 +46,15 @@ define([
/* replace the applyEdits() method */
layer._applyEdits = layer.applyEdits;
/**
* Overrides the ArcGIS API for JavaSccript applyEdits() method.
* @param adds Creates a new edit entry.
* @param updates Updates an existing entry.
* @param deletes Deletes an existing entry.
* @param callback Called when the operation is complete.
* @param errback An error object is returned if an error occurs
* @returns {*} deferred
*/
layer.applyEdits = function(adds,updates,deletes,callback,errback)
{
// inside this method, 'this' will be the FeatureLayer
@ -218,12 +232,20 @@ define([
return this._phantomSymbols[ geometry.type ][ operation ];
},
/**
* Forces library into an offline state. Any edits applied during this condition will be stored locally
*/
goOffline: function()
{
console.log('going offline');
this._onlineStatus = this.OFFLINE;
},
/**
* Forces library to return to an online state. If there are pending edits,
* an attempt will be made to sync them with the remote feature server
* @param callback callback( boolean, errors )
*/
goOnline: function(callback)
{
console.log('going online');
@ -236,11 +258,20 @@ define([
//this.refresh();
},
/**
* Determines if offline or online condition exists
* @returns {string} ONLINE or OFFLINE
*/
getOnlineStatus: function()
{
return this._onlineStatus;
},
/**
* A string value representing human readable information on pending edits
* @param edit
* @returns {string}
*/
getReadableEdit: function(edit)
{
var layer = this._featureLayers[ edit.layer ];