@ionic/storage
Advanced tools
Comparing version 1.1.2 to 1.1.6
/** | ||
* Storage is an easy way to store key/value pairs and other complicated | ||
* data in a way that uses a variety of storage engines underneath. Currently, | ||
* Storage uses localforage underneath to abstract away the various storage | ||
* engines while still providing a simple API. | ||
* Storage is an easy way to store key/value pairs and JSON objects. | ||
* Storage uses a variety of storage engines underneath, picking the best one available | ||
* depending on the platform. | ||
* | ||
* When running natively, Storage will prioritize using SQLite, as it's one of | ||
* When running in a native app context, Storage will prioritize using SQLite, as it's one of | ||
* the most stable and widely used file-based databases, and avoids some of the | ||
* pitfalls of things like localstorage that the OS can decide to clear out in | ||
* low disk-space situations. | ||
* pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such | ||
* data in low disk-space situations. | ||
* | ||
* When running in the web or as a Progressive Web App, Storage will attempt to use | ||
* IndexedDB, WebSQL, and localstorage, in that order. | ||
* | ||
* @usage | ||
* First, if you'd like to use SQLite, install the cordova-sqlite-storage plugin: | ||
* ```bash | ||
* cordova plugin add cordova-sqlite-storage --save | ||
* ``` | ||
* | ||
* Next, install the package (comes by default for Ionic 2 apps >= RC.0) | ||
* | ||
* ```bash | ||
* npm install --save @ionic/storage | ||
* ``` | ||
* | ||
* Next, add it to the providers list in your `NgModule` declaration (for example, in `src/app.module.ts`): | ||
* | ||
* ```typescript | ||
import { Storage } from '@ionic/storage'; | ||
@NgModule({ | ||
declarations: [ | ||
// ... | ||
], | ||
imports: [ | ||
IonicModule.forRoot(MyApp) | ||
], | ||
bootstrap: [IonicApp], | ||
entryComponents: [ | ||
// ... | ||
], | ||
providers: [ | ||
Storage | ||
] | ||
}) | ||
export class AppModule {} | ||
*``` | ||
* | ||
* Finally, inject it into any of your components or pages: | ||
* ```typescript | ||
* import { Storage } from '@ionic/storage'; | ||
* export class MyApp { | ||
* constructor(storage: Storage) { | ||
* storage.set('name', 'Max'); | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
@@ -15,0 +63,0 @@ export declare class Storage { |
@@ -11,18 +11,66 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
/** | ||
* Storage is an easy way to store key/value pairs and other complicated | ||
* data in a way that uses a variety of storage engines underneath. Currently, | ||
* Storage uses localforage underneath to abstract away the various storage | ||
* engines while still providing a simple API. | ||
* Storage is an easy way to store key/value pairs and JSON objects. | ||
* Storage uses a variety of storage engines underneath, picking the best one available | ||
* depending on the platform. | ||
* | ||
* When running natively, Storage will prioritize using SQLite, as it's one of | ||
* When running in a native app context, Storage will prioritize using SQLite, as it's one of | ||
* the most stable and widely used file-based databases, and avoids some of the | ||
* pitfalls of things like localstorage that the OS can decide to clear out in | ||
* low disk-space situations. | ||
* pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such | ||
* data in low disk-space situations. | ||
* | ||
* When running in the web or as a Progressive Web App, Storage will attempt to use | ||
* IndexedDB, WebSQL, and localstorage, in that order. | ||
* | ||
* @usage | ||
* First, if you'd like to use SQLite, install the cordova-sqlite-storage plugin: | ||
* ```bash | ||
* cordova plugin add cordova-sqlite-storage --save | ||
* ``` | ||
* | ||
* Next, install the package (comes by default for Ionic 2 apps >= RC.0) | ||
* | ||
* ```bash | ||
* npm install --save @ionic/storage | ||
* ``` | ||
* | ||
* Next, add it to the providers list in your `NgModule` declaration (for example, in `src/app.module.ts`): | ||
* | ||
* ```typescript | ||
import { Storage } from '@ionic/storage'; | ||
@NgModule({ | ||
declarations: [ | ||
// ... | ||
], | ||
imports: [ | ||
IonicModule.forRoot(MyApp) | ||
], | ||
bootstrap: [IonicApp], | ||
entryComponents: [ | ||
// ... | ||
], | ||
providers: [ | ||
Storage | ||
] | ||
}) | ||
export class AppModule {} | ||
*``` | ||
* | ||
* Finally, inject it into any of your components or pages: | ||
* ```typescript | ||
* import { Storage } from '@ionic/storage'; | ||
* export class MyApp { | ||
* constructor(storage: Storage) { | ||
* storage.set('name', 'Max'); | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
export var Storage = (function () { | ||
function Storage() { | ||
// TODO: Remove this once we figure out our proper build | ||
var _this = this; | ||
this._db = LocalForage; | ||
@@ -33,8 +81,10 @@ this._db.config({ | ||
}); | ||
this._db.setDriver([ | ||
this._db.defineDriver(CordovaSQLiteDriver).then(function () { return _this._db.setDriver([ | ||
CordovaSQLiteDriver._driver, | ||
this._db.INDEXEDDB, | ||
this._db.WEBSQL, | ||
this._db.LOCALSTORAGE | ||
]); | ||
_this._db.INDEXEDDB, | ||
_this._db.WEBSQL, | ||
_this._db.LOCALSTORAGE | ||
]); }).then(function () { | ||
console.info('Ionic Storage driver:', _this._db.driver()); | ||
}); | ||
} | ||
@@ -41,0 +91,0 @@ /** |
/** | ||
* Storage is an easy way to store key/value pairs and other complicated | ||
* data in a way that uses a variety of storage engines underneath. Currently, | ||
* Storage uses localforage underneath to abstract away the various storage | ||
* engines while still providing a simple API. | ||
* Storage is an easy way to store key/value pairs and JSON objects. | ||
* Storage uses a variety of storage engines underneath, picking the best one available | ||
* depending on the platform. | ||
* | ||
* When running natively, Storage will prioritize using SQLite, as it's one of | ||
* When running in a native app context, Storage will prioritize using SQLite, as it's one of | ||
* the most stable and widely used file-based databases, and avoids some of the | ||
* pitfalls of things like localstorage that the OS can decide to clear out in | ||
* low disk-space situations. | ||
* pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such | ||
* data in low disk-space situations. | ||
* | ||
* When running in the web or as a Progressive Web App, Storage will attempt to use | ||
* IndexedDB, WebSQL, and localstorage, in that order. | ||
* | ||
* @usage | ||
* First, if you'd like to use SQLite, install the cordova-sqlite-storage plugin: | ||
* ```bash | ||
* cordova plugin add cordova-sqlite-storage --save | ||
* ``` | ||
* | ||
* Next, install the package (comes by default for Ionic 2 apps >= RC.0) | ||
* | ||
* ```bash | ||
* npm install --save @ionic/storage | ||
* ``` | ||
* | ||
* Next, add it to the providers list in your `NgModule` declaration (for example, in `src/app.module.ts`): | ||
* | ||
* ```typescript | ||
import { Storage } from '@ionic/storage'; | ||
@NgModule({ | ||
declarations: [ | ||
// ... | ||
], | ||
imports: [ | ||
IonicModule.forRoot(MyApp) | ||
], | ||
bootstrap: [IonicApp], | ||
entryComponents: [ | ||
// ... | ||
], | ||
providers: [ | ||
Storage | ||
] | ||
}) | ||
export class AppModule {} | ||
*``` | ||
* | ||
* Finally, inject it into any of your components or pages: | ||
* ```typescript | ||
* import { Storage } from '@ionic/storage'; | ||
* export class MyApp { | ||
* constructor(storage: Storage) { | ||
* storage.set('name', 'Max'); | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
@@ -15,0 +63,0 @@ export declare class Storage { |
@@ -12,18 +12,66 @@ "use strict"; | ||
/** | ||
* Storage is an easy way to store key/value pairs and other complicated | ||
* data in a way that uses a variety of storage engines underneath. Currently, | ||
* Storage uses localforage underneath to abstract away the various storage | ||
* engines while still providing a simple API. | ||
* Storage is an easy way to store key/value pairs and JSON objects. | ||
* Storage uses a variety of storage engines underneath, picking the best one available | ||
* depending on the platform. | ||
* | ||
* When running natively, Storage will prioritize using SQLite, as it's one of | ||
* When running in a native app context, Storage will prioritize using SQLite, as it's one of | ||
* the most stable and widely used file-based databases, and avoids some of the | ||
* pitfalls of things like localstorage that the OS can decide to clear out in | ||
* low disk-space situations. | ||
* pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such | ||
* data in low disk-space situations. | ||
* | ||
* When running in the web or as a Progressive Web App, Storage will attempt to use | ||
* IndexedDB, WebSQL, and localstorage, in that order. | ||
* | ||
* @usage | ||
* First, if you'd like to use SQLite, install the cordova-sqlite-storage plugin: | ||
* ```bash | ||
* cordova plugin add cordova-sqlite-storage --save | ||
* ``` | ||
* | ||
* Next, install the package (comes by default for Ionic 2 apps >= RC.0) | ||
* | ||
* ```bash | ||
* npm install --save @ionic/storage | ||
* ``` | ||
* | ||
* Next, add it to the providers list in your `NgModule` declaration (for example, in `src/app.module.ts`): | ||
* | ||
* ```typescript | ||
import { Storage } from '@ionic/storage'; | ||
@NgModule({ | ||
declarations: [ | ||
// ... | ||
], | ||
imports: [ | ||
IonicModule.forRoot(MyApp) | ||
], | ||
bootstrap: [IonicApp], | ||
entryComponents: [ | ||
// ... | ||
], | ||
providers: [ | ||
Storage | ||
] | ||
}) | ||
export class AppModule {} | ||
*``` | ||
* | ||
* Finally, inject it into any of your components or pages: | ||
* ```typescript | ||
* import { Storage } from '@ionic/storage'; | ||
* export class MyApp { | ||
* constructor(storage: Storage) { | ||
* storage.set('name', 'Max'); | ||
* storage.get('name').then((val) => { | ||
* console.log('Your name is', val); | ||
* }) | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
var Storage = (function () { | ||
function Storage() { | ||
// TODO: Remove this once we figure out our proper build | ||
var _this = this; | ||
this._db = localforage_1.default; | ||
@@ -34,8 +82,10 @@ this._db.config({ | ||
}); | ||
this._db.setDriver([ | ||
this._db.defineDriver(localforage_cordovasqlitedriver_1.default).then(function () { return _this._db.setDriver([ | ||
localforage_cordovasqlitedriver_1.default._driver, | ||
this._db.INDEXEDDB, | ||
this._db.WEBSQL, | ||
this._db.LOCALSTORAGE | ||
]); | ||
_this._db.INDEXEDDB, | ||
_this._db.WEBSQL, | ||
_this._db.LOCALSTORAGE | ||
]); }).then(function () { | ||
console.info('Ionic Storage driver:', _this._db.driver()); | ||
}); | ||
} | ||
@@ -42,0 +92,0 @@ /** |
{ | ||
"name": "@ionic/storage", | ||
"version": "1.1.2", | ||
"version": "1.1.6", | ||
"description": "Ionic Storage utility", | ||
@@ -13,3 +13,4 @@ "main": "es2015/index.js", | ||
"preparePackage": "node ./scripts/copy-package", | ||
"build": "npm run clean && npm run build-cjs && npm run build-es2015 && npm run preparePackage" | ||
"build": "npm run clean && npm run build-cjs && npm run build-es2015 && npm run preparePackage", | ||
"publishPackage": "npm run build && cd dist && npm publish" | ||
}, | ||
@@ -37,5 +38,5 @@ "repository": { | ||
"localforage": "^1.4.2", | ||
"localforage-cordovasqlitedriver": "driftyco/localforage-cordovasqlitedriver#9803562a61c2172a69f3475f97e98922c0b49ac0", | ||
"localforage-cordovasqlitedriver": "^1.5.0", | ||
"rxjs": "5.0.0-beta.12" | ||
} | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16744
493
0
1
+ Addedlocalforage-cordovasqlitedriver@1.8.0(transitive)