mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
adds isDBValid() to TPKLayer
This commit is contained in:
parent
71c3809b3b
commit
f255a4ce52
@ -32,6 +32,7 @@ Methods | Returns | Description
|
||||
`setMaxDBSize(size)`| nothing | (Optional) Let's you specify a maximum size in MBs for the local database. The default is 75MBs. Recommended maximum is 100MBs. Important: Making the database too large can result in browser crashes and slow application performance.
|
||||
`getDBSize(callback)`| `callback(size,err)` | Returns the size of local database in bytes or an error message. Calling this too often during parsing operations can affect application performance.
|
||||
`setDBWriteable(value)`| nothing | Default is true. Value is boolean. Let's you programmatically allow or not allow the storing of tiles in the local database. This method can help you manage the size of the database. Use this in conjunction with `getDBSize()` on a map pan or zoom event listener. Tile retrieval times from images stored in the database are significantly faster than pulling images from the TPK.
|
||||
`isDBValid()` | boolean | Verifies whether not the browser supports this library.
|
||||
|
||||
###Events
|
||||
Event | Value | Description
|
||||
|
||||
@ -45,6 +45,7 @@ define([
|
||||
//
|
||||
_maxDBSize: 75, // User configurable maximum size in MBs.
|
||||
_isDBWriteable: true, // Manually allow or stop writing to the database.
|
||||
_isDBValid: false, // Does the browser support IndexedDB or IndexedDBShim
|
||||
_autoCenter: null, // Auto center the map
|
||||
_fileEntriesLength: 0, // Number of files in zip
|
||||
_inMemTilesObject: null, // Stores unzipped files from tpk
|
||||
@ -186,6 +187,15 @@ define([
|
||||
this._isDBWriteable = value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Validates whether or not the browser supports this library
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isDBValid: function(){
|
||||
this._validate();
|
||||
return this._isDBValid;
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs specific validation tasks. Reserved for future use.
|
||||
* Currently only throws console errors. Does not stop execution of the library!
|
||||
@ -217,7 +227,8 @@ define([
|
||||
this.emit(this.DATABASE_ERROR_EVENT,{msg:this.DB_FULL_ERROR,err : err});
|
||||
}
|
||||
this.emit(this.VALIDATION_EVENT,{msg:this.DB_VALIDATED,err : null})
|
||||
console.log("DB size: " + mb + " MBs, Tile count: " + size.tileCount + ", Error: " + err)
|
||||
console.log("DB size: " + mb + " MBs, Tile count: " + size.tileCount + ", Error: " + err);
|
||||
this._isDBValid = true;
|
||||
}.bind(this))
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
@ -21,6 +21,7 @@ describe("TPKLayer module", function(){
|
||||
{
|
||||
expect(tpkLayer).toEqual(jasmine.any(Object));
|
||||
expect(tpkLayer.store).toEqual(jasmine.any(Object));
|
||||
expect(tpkLayer.isDBValid()).toBe(true);
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user