Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 6b71a07

Browse files
committed
feat: customizable WEBSTORAGE_CONFIG
1 parent d569f4d commit 6b71a07

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export { WebStorageUtility } from './utility/webstorage.utility';
77
export declare class Webstorable {
88
save(): void;
99
}
10+
export let WEBSTORAGE_CONFIG = {
11+
prefix: 'angular2ws_'
12+
};
1013

1114
@NgModule({
1215
providers: [LocalStorageService, SessionStorageService]

src/utility/webstorage.utility.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const KEY_PREFIX = "angular2ws";
1+
import {WEBSTORAGE_CONFIG} from '../index';
22

33
export class WebStorageUtility {
44
static generateStorageKey(key: string): string {
5-
return `${KEY_PREFIX}_${key}`
5+
return `${WEBSTORAGE_CONFIG.prefix}${key}`
66
}
77

88
static get(storage: Storage, key: string): any {

0 commit comments

Comments
 (0)