Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.14 KB

COLLISION.md

File metadata and controls

37 lines (27 loc) · 1.14 KB

Collision guide

All client-side storages (both indexedDB and localStorage) are restricted to the same subdomain, so there is no risk of collision in most cases. Only if you have multiple apps on the same subdomain and you don't want to share data between them, you need to add a prefix.

Version

This is the up to date guide about collision for version >= 8 of this lib.

The old guide about collision in versions < 8 is available here, but is not recommended as there was breaking changes in v8.

Configuration

For example:

import { StorageModule } from '@ngx-pwa/local-storage';

@NgModule({
  imports: [
    StorageModule.forRoot({
      IDBDBName: 'myAppStorage', // custom database name when in `indexedDB`
      LSPrefix: 'myapp_', // prefix when in `localStorage` fallback
    })
  ]
})
export class AppModule {}

Note:

  • it is an initialization step, so as mentioned in the example, it must be done in AppModule,
  • never change these options in an app already deployed in production, as all previously stored data would be lost.

Back to general documentation