@ionic/storage
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -1,2 +0,1 @@ | ||
/// <reference types="localforage" /> | ||
/** | ||
@@ -57,9 +56,12 @@ * Storage is an easy way to store key/value pairs and JSON objects. | ||
* | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* storage.ready().then(() => { | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* }); | ||
* } | ||
@@ -79,3 +81,3 @@ * } | ||
* export function provideStorage() { | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }// optional config); | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }); | ||
* } | ||
@@ -97,2 +99,3 @@ * | ||
private _dbPromise; | ||
private _driver; | ||
/** | ||
@@ -106,6 +109,16 @@ * Create a new Storage instance using the order of drivers and any additional config | ||
constructor(driverOrder?: [string], config?: any); | ||
/** | ||
* Get the name of the driver being used. | ||
* @return Name of the driver | ||
*/ | ||
readonly driver: string; | ||
/** | ||
* Reflect the readiness of the store. | ||
* @return Promise that resolves when the store is ready | ||
*/ | ||
ready(): Promise<LocalForage>; | ||
_getDriverOrder(driverOrder: any): any; | ||
/** | ||
* Get the value assocated with the given key. | ||
* Get the value associated with the given key. | ||
* @param key the key to identify this value | ||
* @return Promise that resolves with the value | ||
@@ -129,11 +142,11 @@ */ | ||
* Clear the entire key value store. WARNING: HOT! | ||
* @return Promise that resolves when the kv store is cleared | ||
* @return Promise that resolves when the store is cleared | ||
*/ | ||
clear(): Promise<null>; | ||
/** | ||
* @return the number of keys stored. | ||
* @return Promise that resolves with the number of keys stored. | ||
*/ | ||
length(): Promise<number>; | ||
/** | ||
* @return the keys in the store. | ||
* @return Promise that resolves with the keys in the store. | ||
*/ | ||
@@ -144,4 +157,5 @@ keys(): Promise<string[]>; | ||
* @param iteratorCallback a callback of the form (value, key, iterationNumber) | ||
* @return Promise that resolves when the iteration has finished. | ||
*/ | ||
forEach(iteratorCallback: (value: any, key: string, iterationNumber: Number) => any): Promise<null>; | ||
} |
@@ -65,9 +65,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
* | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* storage.ready().then(() => { | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* }); | ||
* } | ||
@@ -87,3 +90,3 @@ * } | ||
* export function provideStorage() { | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }// optional config); | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }); | ||
* } | ||
@@ -103,3 +106,3 @@ * | ||
*/ | ||
var Storage = (function () { | ||
export var Storage = (function () { | ||
/** | ||
@@ -113,4 +116,5 @@ * Create a new Storage instance using the order of drivers and any additional config | ||
function Storage(driverOrder, config) { | ||
var _this = this; | ||
if (driverOrder === void 0) { driverOrder = ['sqlite', 'indexeddb', 'websql', 'localstorage']; } | ||
var _this = this; | ||
this._driver = null; | ||
this._dbPromise = new Promise(function (resolve, reject) { | ||
@@ -133,3 +137,3 @@ var db; | ||
.then(function () { | ||
console.info('Ionic Storage driver:', db.driver()); | ||
_this._driver = db.driver(); | ||
resolve(db); | ||
@@ -140,2 +144,17 @@ }) | ||
} | ||
Object.defineProperty(Storage.prototype, "driver", { | ||
/** | ||
* Get the name of the driver being used. | ||
* @return Name of the driver | ||
*/ | ||
get: function () { | ||
return this._driver; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Reflect the readiness of the store. | ||
* @return Promise that resolves when the store is ready | ||
*/ | ||
Storage.prototype.ready = function () { | ||
@@ -159,3 +178,4 @@ return this._dbPromise; | ||
/** | ||
* Get the value assocated with the given key. | ||
* Get the value associated with the given key. | ||
* @param key the key to identify this value | ||
* @return Promise that resolves with the value | ||
@@ -185,3 +205,3 @@ */ | ||
* Clear the entire key value store. WARNING: HOT! | ||
* @return Promise that resolves when the kv store is cleared | ||
* @return Promise that resolves when the store is cleared | ||
*/ | ||
@@ -192,3 +212,3 @@ Storage.prototype.clear = function () { | ||
/** | ||
* @return the number of keys stored. | ||
* @return Promise that resolves with the number of keys stored. | ||
*/ | ||
@@ -199,3 +219,3 @@ Storage.prototype.length = function () { | ||
/** | ||
* @return the keys in the store. | ||
* @return Promise that resolves with the keys in the store. | ||
*/ | ||
@@ -208,2 +228,3 @@ Storage.prototype.keys = function () { | ||
* @param iteratorCallback a callback of the form (value, key, iterationNumber) | ||
* @return Promise that resolves when the iteration has finished. | ||
*/ | ||
@@ -213,7 +234,6 @@ Storage.prototype.forEach = function (iteratorCallback) { | ||
}; | ||
Storage = __decorate([ | ||
Injectable() | ||
], Storage); | ||
return Storage; | ||
}()); | ||
Storage = __decorate([ | ||
Injectable() | ||
], Storage); | ||
export { Storage }; |
"use strict"; | ||
var storage_1 = require("./storage"); | ||
var storage_1 = require('./storage'); | ||
exports.Storage = storage_1.Storage; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="localforage" /> | ||
/** | ||
@@ -57,9 +56,12 @@ * Storage is an easy way to store key/value pairs and JSON objects. | ||
* | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* storage.ready().then(() => { | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* }); | ||
* } | ||
@@ -79,3 +81,3 @@ * } | ||
* export function provideStorage() { | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }// optional config); | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }); | ||
* } | ||
@@ -97,2 +99,3 @@ * | ||
private _dbPromise; | ||
private _driver; | ||
/** | ||
@@ -106,6 +109,16 @@ * Create a new Storage instance using the order of drivers and any additional config | ||
constructor(driverOrder?: [string], config?: any); | ||
/** | ||
* Get the name of the driver being used. | ||
* @return Name of the driver | ||
*/ | ||
readonly driver: string; | ||
/** | ||
* Reflect the readiness of the store. | ||
* @return Promise that resolves when the store is ready | ||
*/ | ||
ready(): Promise<LocalForage>; | ||
_getDriverOrder(driverOrder: any): any; | ||
/** | ||
* Get the value assocated with the given key. | ||
* Get the value associated with the given key. | ||
* @param key the key to identify this value | ||
* @return Promise that resolves with the value | ||
@@ -129,11 +142,11 @@ */ | ||
* Clear the entire key value store. WARNING: HOT! | ||
* @return Promise that resolves when the kv store is cleared | ||
* @return Promise that resolves when the store is cleared | ||
*/ | ||
clear(): Promise<null>; | ||
/** | ||
* @return the number of keys stored. | ||
* @return Promise that resolves with the number of keys stored. | ||
*/ | ||
length(): Promise<number>; | ||
/** | ||
* @return the keys in the store. | ||
* @return Promise that resolves with the keys in the store. | ||
*/ | ||
@@ -144,4 +157,5 @@ keys(): Promise<string[]>; | ||
* @param iteratorCallback a callback of the form (value, key, iterationNumber) | ||
* @return Promise that resolves when the iteration has finished. | ||
*/ | ||
forEach(iteratorCallback: (value: any, key: string, iterationNumber: Number) => any): Promise<null>; | ||
} |
@@ -8,5 +8,5 @@ "use strict"; | ||
}; | ||
var core_1 = require("@angular/core"); | ||
var localforage_1 = require("localforage"); | ||
var localforage_cordovasqlitedriver_1 = require("localforage-cordovasqlitedriver"); | ||
var core_1 = require('@angular/core'); | ||
var localforage_1 = require('localforage'); | ||
var localforage_cordovasqlitedriver_1 = require('localforage-cordovasqlitedriver'); | ||
/** | ||
@@ -67,9 +67,12 @@ * Storage is an easy way to store key/value pairs and JSON objects. | ||
* | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* storage.ready().then(() => { | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* // set a key/value | ||
* storage.set('name', 'Max'); | ||
* | ||
* // Or to get a key/value pair | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* }); | ||
* } | ||
@@ -89,3 +92,3 @@ * } | ||
* export function provideStorage() { | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }// optional config); | ||
* return new Storage(['sqlite', 'websql', 'indexeddb'], { name: '__mydb' }); | ||
* } | ||
@@ -114,4 +117,5 @@ * | ||
function Storage(driverOrder, config) { | ||
var _this = this; | ||
if (driverOrder === void 0) { driverOrder = ['sqlite', 'indexeddb', 'websql', 'localstorage']; } | ||
var _this = this; | ||
this._driver = null; | ||
this._dbPromise = new Promise(function (resolve, reject) { | ||
@@ -134,3 +138,3 @@ var db; | ||
.then(function () { | ||
console.info('Ionic Storage driver:', db.driver()); | ||
_this._driver = db.driver(); | ||
resolve(db); | ||
@@ -141,2 +145,17 @@ }) | ||
} | ||
Object.defineProperty(Storage.prototype, "driver", { | ||
/** | ||
* Get the name of the driver being used. | ||
* @return Name of the driver | ||
*/ | ||
get: function () { | ||
return this._driver; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Reflect the readiness of the store. | ||
* @return Promise that resolves when the store is ready | ||
*/ | ||
Storage.prototype.ready = function () { | ||
@@ -160,3 +179,4 @@ return this._dbPromise; | ||
/** | ||
* Get the value assocated with the given key. | ||
* Get the value associated with the given key. | ||
* @param key the key to identify this value | ||
* @return Promise that resolves with the value | ||
@@ -186,3 +206,3 @@ */ | ||
* Clear the entire key value store. WARNING: HOT! | ||
* @return Promise that resolves when the kv store is cleared | ||
* @return Promise that resolves when the store is cleared | ||
*/ | ||
@@ -193,3 +213,3 @@ Storage.prototype.clear = function () { | ||
/** | ||
* @return the number of keys stored. | ||
* @return Promise that resolves with the number of keys stored. | ||
*/ | ||
@@ -200,3 +220,3 @@ Storage.prototype.length = function () { | ||
/** | ||
* @return the keys in the store. | ||
* @return Promise that resolves with the keys in the store. | ||
*/ | ||
@@ -209,2 +229,3 @@ Storage.prototype.keys = function () { | ||
* @param iteratorCallback a callback of the form (value, key, iterationNumber) | ||
* @return Promise that resolves when the iteration has finished. | ||
*/ | ||
@@ -214,7 +235,7 @@ Storage.prototype.forEach = function (iteratorCallback) { | ||
}; | ||
Storage = __decorate([ | ||
core_1.Injectable() | ||
], Storage); | ||
return Storage; | ||
}()); | ||
Storage = __decorate([ | ||
core_1.Injectable() | ||
], Storage); | ||
exports.Storage = Storage; |
{ | ||
"name": "@ionic/storage", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "Ionic Storage utility", | ||
@@ -34,8 +34,10 @@ "main": "es2015/index.js", | ||
"dependencies": { | ||
"@angular/core": "^2.0.0", | ||
"@types/localforage": "0.0.30", | ||
"localforage": "^1.4.2", | ||
"localforage-cordovasqlitedriver": "^1.5.0", | ||
"rxjs": "5.0.0-beta.12" | ||
"localforage": "~1.4.2", | ||
"localforage-cordovasqlitedriver": "~1.5.0" | ||
}, | ||
"peerDependencies": { | ||
"@angular/core": "*", | ||
"rxjs": "*" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26691
771
+ Added@angular/core@18.2.10(transitive)
+ Addedacorn@1.2.2(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedast-types@0.8.15(transitive)
+ Addedbase62@0.1.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedes3ify@0.1.4(transitive)
+ Addedesmangle-evaluator@1.0.1(transitive)
+ Addedesprima-fb@15001.1001.0-dev-harmony-fb3001.1.0-dev-harmony-fb(transitive)
+ Addedfalafel@1.2.0(transitive)
+ Addedforeach@2.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinline-process-browser@1.0.0(transitive)
+ Addedisarray@0.0.1(transitive)
+ Addedjstransform@3.0.0(transitive)
+ Addedlie@3.0.2(transitive)
+ Addedlocalforage@1.4.3(transitive)
+ Addedlocalforage-cordovasqlitedriver@1.5.0(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedreadable-stream@1.0.34(transitive)
+ Addedrecast@0.10.43(transitive)
+ Addedrxjs@7.8.1(transitive)
+ Addedsource-map@0.1.310.5.7(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedthrough2@0.6.5(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedunreachable-branch-transform@0.3.0(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedzone.js@0.14.10(transitive)
- Removed@angular/core@^2.0.0
- Removedrxjs@5.0.0-beta.12
- Removed@angular/core@2.4.10(transitive)
- Removedlie@3.1.1(transitive)
- Removedlocalforage@1.10.0(transitive)
- Removedlocalforage-cordovasqlitedriver@1.8.0(transitive)
- Removedrxjs@5.0.0-beta.125.5.12(transitive)
- Removedsymbol-observable@1.0.1(transitive)
- Removedzone.js@0.7.8(transitive)
Updatedlocalforage@~1.4.2