Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 935 Bytes

COLLISION.md

File metadata and controls

30 lines (23 loc) · 935 Bytes

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.

Configuration

For example:

import { StorageModule } from '@ngx-builders/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