Skip to content

Commit 986343d

Browse files
committed
chore: function storage
1 parent 2a5489b commit 986343d

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,23 @@ const ngHttpCachingConfig: NgHttpCachingConfig = {
120120
};
121121
```
122122

123-
there is also a `NgHttpCachingLocalStorage` a cache store with persistence into `localStorage`:
123+
there is also a `withNgHttpCachingLocalStorage` a cache store with persistence into `localStorage`:
124124

125125
```ts
126-
import { NgHttpCachingConfig, NgHttpCachingLocalStorage } from 'ng-http-caching';
126+
import { NgHttpCachingConfig, withNgHttpCachingLocalStorage } from 'ng-http-caching';
127127

128128
const ngHttpCachingConfig: NgHttpCachingConfig = {
129-
store: new NgHttpCachingLocalStorage(),
129+
store: withNgHttpCachingLocalStorage(),
130130
};
131131
```
132132

133-
and a `NgHttpCachingSessionStorage` a cache store with persistence into `sessionStorage`:
133+
and a `withNgHttpCachingSessionStorage` a cache store with persistence into `sessionStorage`:
134134

135135
```ts
136-
import { NgHttpCachingConfig, NgHttpCachingSessionStorage } from 'ng-http-caching';
136+
import { NgHttpCachingConfig, withNgHttpCachingSessionStorage } from 'ng-http-caching';
137137

138138
const ngHttpCachingConfig: NgHttpCachingConfig = {
139-
store: new NgHttpCachingSessionStorage(),
139+
store: withNgHttpCachingSessionStorage(),
140140
};
141141
```
142142

projects/ng-http-caching-demo/src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { enableProdMode, isDevMode } from '@angular/core';
22
import { bootstrapApplication } from '@angular/platform-browser';
33
import { AppComponent } from './app/app.component';
4-
import { NgHttpCachingLocalStorage, provideNgHttpCaching } from 'projects/ng-http-caching/src/public-api';
4+
import { withNgHttpCachingLocalStorage, provideNgHttpCaching } from 'projects/ng-http-caching/src/public-api';
55
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
66

77
if (!isDevMode()) {
@@ -11,7 +11,7 @@ if (!isDevMode()) {
1111
bootstrapApplication(AppComponent, {
1212
providers: [
1313
provideNgHttpCaching({
14-
store: new NgHttpCachingLocalStorage()
14+
store: withNgHttpCachingLocalStorage()
1515
}),
1616
provideHttpClient(withInterceptorsFromDi())
1717
]

projects/ng-http-caching/src/lib/storage/ng-http-caching-local-storage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ export class NgHttpCachingLocalStorage extends NgHttpCachingBrowserStorage {
66
super(localStorage);
77
}
88
}
9+
10+
export const withNgHttpCachingLocalStorage = () => new NgHttpCachingLocalStorage();

projects/ng-http-caching/src/lib/storage/ng-http-caching-session-storage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ export class NgHttpCachingSessionStorage extends NgHttpCachingBrowserStorage {
66
super(sessionStorage);
77
}
88
}
9+
10+
export const withNgHttpCachingSessionStorage = () => new NgHttpCachingSessionStorage();

0 commit comments

Comments
 (0)