How to use @ionic/storage - 10 common examples

To help you get started, we’ve selected a few @ionic/storage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github natural-apptitude / ngrx-store-ionic-storage / src / index.ts View on Github external
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
import { Effect } from '@ngrx/effects';
import { ActionReducer } from '@ngrx/store';
import { defer, from, Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';

const STORAGE_KEY = 'NSIS_APP_STATE';

const storage = new Storage({});

// get/setNested inspired by
// https://github.com/mickhansen/dottie.js
function getNested(obj: any, path: string): any {
  if (obj !== null && path) {
    // Recurse into the object.
    const parts = path.split('.').reverse();
    while (obj != null && parts.length) {
      obj = obj[parts.pop()];
    }
  }
  return obj;
}

function setNested(obj: any, path: string, value: any): any {
  if (obj != null && path) {
github yajuve / temo-chat-ionic / src / app / app.module.ts View on Github external
@NgModule({
  declarations: [
    MyApp
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    }),
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp
  ],
  providers: [
    Items,
    Camera,
    SplashScreen,
    StatusBar,
    MessageMocks,
    // Keep this to enable Ionic's runtime error handling during development
    { provide: ErrorHandler, useClass: IonicErrorHandler },
    HttpProvider,
    Util,
    UserProvider
github apppresser / ap3 / src / app / app.module.ts View on Github external
// required for ng translate, tells it to look in assets folder for trans files
export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, "assets/i18n/", ".json");
}

export class MyMissingTranslationHandler implements MissingTranslationHandler {
  handle(params: MissingTranslationHandlerParams) {
    return params.key;
  }
}

@NgModule({
  declarations: [MyApp, Iframe],
  imports: [
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot(),
    BrowserModule,
    HttpModule,
    HttpClientModule,
    AudioPlayerComponentModule,
    Angulartics2RouterlessModule.forRoot([Angulartics2GoogleAnalytics]),
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    })
  ],
  bootstrap: [IonicApp],
  entryComponents: [MyApp, Iframe],
  providers: [
github abritopach / ionic-offline-mode / src / app / app.module.ts View on Github external
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

import { HttpClientModule } from '@angular/common/http';
import { IonicStorageModule } from '@ionic/storage';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    HttpClientModule,
    IonicStorageModule.forRoot(
      {
        name: '__mydb',
        driverOrder: ['indexeddb', 'sqlite', 'websql']
      }
    )
  ],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
github phodal / growth-ionic / src / app / app.module.ts View on Github external
DonatePage,
    PaperPage,
    TutorialPage,
    TabsPage
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp, {
      tabbarPlacement: "bottom",
      backButtonText: "后退",
      tabsHideOnSubPages: true,
      tabsHighlight: true
    }),
    MomentModule,
    IonicStorageModule.forRoot(),
    Ionic2RatingModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    DiscoverPage,
    HomePage,
    Section,
    BookListModal,
    HtmlModal,
    TodoModal,
    SkillModal,
    ArticleDetailPage,
    ArticleListPage,
    ChapterListPage,
    ChapterDetailPage,
github meltuhamy / belfastsalah / src / app / app.module.ts View on Github external
PrayerTimesApp,
    MonthPage,
    MonthSelector,
    SettingsPage,
    MinuteSelectorModal,
    TodayPage,
    TabsPage,
    PrayerItemComponent,
    PrayerGridComponent,
    TitleCasePipe
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(PrayerTimesApp),
    IonicStorageModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    PrayerTimesApp,
    MonthPage,
    SettingsPage,
    TodayPage,
    TabsPage,
    MonthSelector,
    MinuteSelectorModal
  ],
  providers: [
    { provide: Settings, useFactory: provideSettings, deps: [ Storage ] },
    PrayerTimes,
    LocalNotifications,
    Device,
github ionic-team / ionic-conference-app / src / app / app.module.ts View on Github external
import { IonicStorageModule } from '@ionic/storage';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { FormsModule } from '@angular/forms';

@NgModule({
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    FormsModule,
    IonicModule.forRoot(),
    IonicStorageModule.forRoot(),
    ServiceWorkerModule.register('ngsw-worker.js', {
      enabled: environment.production
    })
  ],
  declarations: [AppComponent],
  providers: [InAppBrowser, SplashScreen, StatusBar],
  bootstrap: [AppComponent]
})
export class AppModule {}
github gaccettola / mortis / client_mobile / source / src / app / app.module.ts View on Github external
@NgModule (
{
    declarations    :
    [
        AppComponent
    ,   LoginComponent
    ,   DashboardComponent
    ,   DesignerComponent
    ,   MailComponent
    ,   SettingsComponent
    ],
    imports         :
    [
        IonicModule.forRoot(AppComponent)
    ,   IonicStorageModule.forRoot()
    ,   BrowserModule
    ,   HttpModule
    ],
    providers       :
    [
        StatusBar
    ,   SocketService
    ,   SplashScreen
    ,   DataframeBase
    ,   DataframeAccount
    ,   DatastoreService
    ,   NotifyService
    ],
    entryComponents :
    [
        AppComponent
github supertorpe / chessendgametraining / src / app / app.module.ts View on Github external
import { IdlePreloadModule } from './core/idle-preload.module';
import { SharedModule } from './shared';
import { RequestCacheService, RequestCacheWithMap } from './core/request-cache.service';
import { CacheInterceptor } from './core/cache.interceptor';

export function createTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    IonicStorageModule.forRoot(),
    IdlePreloadModule.forRoot(),
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    }),
    AppRoutingModule,
    HttpClientModule,
    SharedModule.forRoot()
  ],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },

@ionic/storage

Ionic Storage Helper

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis