mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
1 line
23 KiB
JSON
1 line
23 KiB
JSON
|
|
{"ast":null,"code":"import { __decorate, __param } from 'tslib';\nimport { Inject, PLATFORM_ID, InjectionToken, NgModule } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport { defineDriver, createInstance, LOCALSTORAGE, WEBSQL, INDEXEDDB } from 'localforage';\nimport * as CordovaSQLiteDriver from 'localforage-cordovasqlitedriver';\nimport { _driver } from 'localforage-cordovasqlitedriver';\n\n/**\n * Storage is an easy way to store key/value pairs and JSON objects.\n * Storage uses a variety of storage engines underneath, picking the best one available\n * depending on the platform.\n *\n * When running in a native app context, Storage will prioritize using SQLite, as it's one of\n * the most stable and widely used file-based databases, and avoids some of the\n * pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such\n * data in low disk-space situations.\n *\n * When running in the web or as a Progressive Web App, Storage will attempt to use\n * IndexedDB, WebSQL, and localstorage, in that order.\n *\n * @usage\n * First, if you'd like to use SQLite, install the cordova-sqlite-storage plugin:\n * ```bash\n * ionic cordova plugin add cordova-sqlite-storage\n * ```\n *\n * Next, install the package (comes by default for Ionic apps > Ionic V1):\n * ```bash\n * npm install --save @ionic/storage\n * ```\n *\n * Next, add it to the imports list in your `NgModule` declaration (for example, in `src/app/app.module.ts`):\n *\n * ```typescript\n * import { IonicStorageModule } from '@ionic/storage';\n *\n * @NgModule({\n * declarations: [\n * // ...\n * ],\n * imports: [\n * BrowserModule,\n * IonicModule.forRoot(MyApp),\n * IonicStorageModule.forRoot()\n * ],\n * bootstrap: [IonicApp],\n * entryComponents: [\n * // ...\n * ],\n * providers: [\n * // ...\n * ]\n * })\n * export class AppModule {}\n *```\n *\n * Finally, inject it into any of your components or pages:\n * ```typescript\n * import { Storage } from '@ionic/storage';\n\n * export class MyApp {\n * constructor(private storage: Storage) { }\n *\n * ...\n *\n * // set a key/value\n * storage.set('name', 'Max');\n *\n * // Or to get a key/value pair\n * storage.get('age').then((val) => {\n * console.log('Your age is', val);\n * });\n * }\n * ```\n *\n *\n * ### Configuring Storage\n *\n * The Storage engine can be configured both with specific storage engine priorities, or custom configuration\n * options to pass to localForage. See the localForage config docs for possible options: https://github.com/localForage/localForage#configuration\n *\n * Note: Any custom configurations will be merged with the default configuration\n *\n * ```typescript\n * import { IonicStorageModule } from '@ionic/storage';\n *\n * @NgModule({\n * declarations: [...],\n * imports: [\n * IonicStorageModule.forRoot({\n * name: '__mydb',\n driverOrder: ['indexeddb', 'sqlite', 'websql']\n * })\n * ],\n * bootstrap: [...],\n * entryComponents: [...],\n * providers: [...]\n * })\n * export class AppModule { }\n * ```\n */\nimport * as ɵngcc0 from '@angular/core';\nlet Storage = class Storage {\n /**\n * Create a new Storage instance using the order of drivers and any additional config\n * options to pass to LocalForage.\n *\n * Possible driver options are: ['sqlite', 'indexeddb', 'websql', 'localstorage'] and the\n * default is that exact ordering.\n */\n constructor(config, platformId) {\n this.platformId = platformId;\n this._driver = null;\n this._dbPromise = new Promise((resolve, reject) => {\n if (isPlatformServer(this.platformId)) {\n const noopDriver = getNoopDriver();\n resolve(noopDriver);\n return;\n }\n let db;\n const defaultConfig = getDefaultConfig();\n const actualConfig = Object.assign(defaultConfig, config || {});\n defineDriver(CordovaSQLiteDriver).then(() => {\n db = createInstance(actualConfig);\n }).then(() => db.setDriver(this._get
|