How to use @ngx-pwa/local-storage - 4 common examples

To help you get started, we’ve selected a few @ngx-pwa/local-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 OpenSlides / OpenSlides / client / src / app / core / local-storage / custom-indexeddb-database.ts View on Github external
platformId: Object,
    storagelock: StoragelockService,
    prefix: string | null
): LocalDatabase {
    if (isPlatformBrowser(platformId) && 'indexedDB' in window && indexedDB !== undefined && indexedDB !== null) {
        // Try with IndexedDB in modern browsers
        // CUSTOM: Use our own IndexedDB implementation
        return new CustomIndexedDBDatabase(storagelock, prefix);
    } else if (
        isPlatformBrowser(platformId) &&
        'localStorage' in window &&
        localStorage !== undefined &&
        localStorage !== null
    ) {
        // Try with localStorage in old browsers (IE9)
        return new LocalStorageDatabase(prefix);
    } else {
        // Fake database for server-side rendering (Universal)
        return new MockLocalDatabase();
    }
}
github OpenSlides / OpenSlides / client / src / app / core / local-storage / custom-indexeddb-database.ts View on Github external
): LocalDatabase {
    if (isPlatformBrowser(platformId) && 'indexedDB' in window && indexedDB !== undefined && indexedDB !== null) {
        // Try with IndexedDB in modern browsers
        // CUSTOM: Use our own IndexedDB implementation
        return new CustomIndexedDBDatabase(storagelock, prefix);
    } else if (
        isPlatformBrowser(platformId) &&
        'localStorage' in window &&
        localStorage !== undefined &&
        localStorage !== null
    ) {
        // Try with localStorage in old browsers (IE9)
        return new LocalStorageDatabase(prefix);
    } else {
        // Fake database for server-side rendering (Universal)
        return new MockLocalDatabase();
    }
}
github cyrilletuzi / angular-async-local-storage / projects / ivy / src / app / app.module.ts View on Github external
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { StorageModule } from '@ngx-pwa/local-storage';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    StorageModule.forRoot({
      IDBNoWrap: true,
    })
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
github cyrilletuzi / angular-async-local-storage / projects / localforage / src / app / app.module.ts View on Github external
import { NgModule } from '@angular/core';
import { StorageModule } from '@ngx-pwa/local-storage';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { HomeComponent } from './home/home.component';

@NgModule({
  declarations: [
    AppComponent,
    HomeComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    StorageModule.forRoot({
      LSPrefix: 'localforage/',
      IDBDBName: 'localforage',
      IDBStoreName: 'keyvaluepairs'
    }),
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

@ngx-pwa/local-storage

Efficient local storage module for Angular: simple API based on native localStorage API, but internally stored via the asynchronous IndexedDB API for performance, and wrapped in RxJS observables to be homogeneous with other Angular modules.

MIT
Latest version published 3 days ago

Package Health Score

75 / 100
Full package analysis

Similar packages