How to use the @ngx-pwa/local-storage.MockLocalDatabase function in @ngx-pwa/local-storage

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
): 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();
    }
}

@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 6 months ago

Package Health Score

74 / 100
Full package analysis

Similar packages