mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
adds layer.getUsage()
This commit is contained in:
parent
3946006b2b
commit
a5581aade5
@ -87,6 +87,7 @@ Methods | Returns | Description
|
||||
`getPhantomLayerGraphics( callback) ` | `callback( graphicsLayerJSON)` | Used with offline browser restarts. Returns a JSON representation of the internal phantom graphics layer. This layer is designed to indicate to the user any graphic that has been modified while offline. The appcache-features.html sample demonstrates this pattern.
|
||||
`addAttachments()` | Internal | Adds an attachment.
|
||||
`deleteAttachments()` | Internal | Deletes an attachment.
|
||||
`getUsage(callback)`| `callback({usage}, error)` | **New @ v2.5** Returns the approximate size of the database in bytes. the usage Object is {sizeBytes: number, editCount: number}.
|
||||
`getPhantomGraphicsArray( callback)` | `callback(boolean, array)` | **New @ v2.5** Used with offline browser restarts. Returns an array of phantom graphics from the database.
|
||||
`getAllEditsArray(callback)` | `callback(boolean, array)` | **New @ v2.5** Returns an array of all edits stored in the database.
|
||||
`getFeatureLayerJSON(url,callback)` | `callback( boolean, JSON )` | **New @ v2.5.** Retrieves the feature layer's JSON using `f=json` parameter.
|
||||
|
||||
@ -798,7 +798,7 @@ O.esri.Edit.EditStore = function () {
|
||||
/**
|
||||
* Returns the approximate size of the database in bytes
|
||||
* IMPORTANT: Currently requires all data be serialized!
|
||||
* @param callback {usage, error} Whereas, the usage Object is {sizeBytes: number, editCount: number}
|
||||
* @param callback callback({usage}, error) Whereas, the usage Object is {sizeBytes: number, editCount: number}
|
||||
*/
|
||||
this.getUsage = function (callback) {
|
||||
console.assert(this._db !== null, "indexeddb not initialized");
|
||||
|
||||
@ -543,6 +543,16 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the approximate size of the database in bytes
|
||||
* @param callback callback({usage}, error) Whereas, the usage Object is {sizeBytes: number, editCount: number}
|
||||
*/
|
||||
layer.getUsage = function(callback){
|
||||
self._editStore.getUsage(function(usage,error){
|
||||
callback(usage,error);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a featureDefinition
|
||||
* @param featureLayer
|
||||
|
||||
@ -410,7 +410,7 @@ describe("Offline Editing", function()
|
||||
});
|
||||
|
||||
async.it("check db size", function(done){
|
||||
g_editsStore.getUsage(function(usage,error){
|
||||
g_featureLayers[0].getUsage(function(usage,error){
|
||||
expect(usage.sizeBytes).toBe(7834);
|
||||
expect(usage.editCount).toBe(9);
|
||||
expect(error).toBe(null);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user