diff --git a/doc/howtouseeditlibrary.md b/doc/howtouseeditlibrary.md index 0688f91..fe6c62c 100644 --- a/doc/howtouseeditlibrary.md +++ b/doc/howtouseeditlibrary.md @@ -117,13 +117,13 @@ Within your application you can manually check online status and then update you ``` ####editStore.hasPendingEdits() -You can check if there are any edits pending by using the EditStore library. If there are edits then you can iterate `editsStore._retrieveEditsQueue()` and convert the edits to a readable format via `offlineFeaturesManager.getReadableEdit(edit)`. +You can check if there are any edits pending by using the EditStore library. If there are edits then you can iterate `editsStore.retrieveEditsQueue()` and convert the edits to a readable format via `offlineFeaturesManager.getReadableEdit(edit)`. ```js var editStore = new O.esri.Edit.EditStore(Graphic); if( editStore.hasPendingEdits()) { - var edits = editStore._retrieveEditsQueue(); + var edits = editStore.retrieveEditsQueue(); edits.forEach(function(edit) { var readableEdit = offlineFeaturesManager.getReadableEdit(edit); diff --git a/doc/offlinefeaturesmanager.md b/doc/offlinefeaturesmanager.md index c37b256..417fd61 100644 --- a/doc/offlinefeaturesmanager.md +++ b/doc/offlinefeaturesmanager.md @@ -69,6 +69,7 @@ Methods | Returns | Description `isSupported()` | boolean | Determines if local storage is available. If it is not available then the storage cache will not work. It's a best practice to verify this before attempting to write to the local cache. `hasPendingEdits()` | boolean | Determines if there are any queued edits in the local cache. `resetEditsQueue()` | nothing | Empties the edits queue and replaces it with an empty string. +`retrieveEditsQueue()` | Array | returns an array of all pending edits. `pendingEditsCount()` | int | The total number of edits that are queued in the local cache. `getEditsStoreSizeBytes()` | Number | Returns the total size of all pending edits in bytes. `getLocalStorageSizeBytes()` | Number | Returns the total size in bytes of all items for local storage cached using the current domain name. diff --git a/lib/edit/editsStore.js b/lib/edit/editsStore.js index 6652a74..5a23c6a 100644 --- a/lib/edit/editsStore.js +++ b/lib/edit/editsStore.js @@ -38,7 +38,7 @@ O.esri.Edit.EditStore = function(Graphic){ graphic: this._serialize(graphic) }; - var edits = this._retrieveEditsQueue(); + var edits = this.retrieveEditsQueue(); edits.push(edit); var success = this._storeEditsQueue(edits); return { success: success, error: success? undefined : {code: 1000, description:this.ERROR_LOCALSTORAGE_FULL} }; @@ -46,7 +46,7 @@ O.esri.Edit.EditStore = function(Graphic){ this.peekFirstEdit = function() { - var edits = this._retrieveEditsQueue(); + var edits = this.retrieveEditsQueue(); var firstEdit; if( edits ) @@ -60,7 +60,7 @@ O.esri.Edit.EditStore = function(Graphic){ this.popFirstEdit = function() { - var edits = this._retrieveEditsQueue(); + var edits = this.retrieveEditsQueue(); var firstEdit; if( edits ) @@ -97,6 +97,12 @@ O.esri.Edit.EditStore = function(Graphic){ window.localStorage.setItem(EDITS_QUEUE_KEY, ""); }; + this.retrieveEditsQueue = function() + { + var storedValue = window.localStorage.getItem(EDITS_QUEUE_KEY) || ""; + return this._unpackArrayOfEdits(storedValue); + }; + this.getEditsStoreSizeBytes = function() { var editsQueueValue = window.localStorage.getItem(EDITS_QUEUE_KEY); @@ -147,12 +153,6 @@ O.esri.Edit.EditStore = function(Graphic){ return graphic; }; - this._retrieveEditsQueue = function() - { - var storedValue = window.localStorage.getItem(EDITS_QUEUE_KEY) || ""; - return this._unpackArrayOfEdits(storedValue); - }; - this._storeEditsQueue = function(edits) { try