File tree 3 files changed +43
-42
lines changed
libs/seo/state/src/injection-tokens
3 files changed +43
-42
lines changed Original file line number Diff line number Diff line change 1
- import {
2
- Provider ,
3
- InjectionToken ,
4
- } from '@angular/core' ;
1
+ import { Provider } from '@angular/core' ;
5
2
import { Action } from '@ngrx/store' ;
6
3
4
+ import { createMultiInjectionToken } from '@daffodil/core' ;
5
+
7
6
import { DaffSeoCanonicalUrlUpdate } from '../../models/public_api' ;
8
7
9
- /**
10
- * A multi-provider injection token for providing canonical URL update logic.
11
- * `getData` will run in response to, and invoked with, the action specified.
12
- */
13
- export const DAFF_SEO_CANONICAL_URL_UPDATES = new InjectionToken < DaffSeoCanonicalUrlUpdate [ ] > ( 'DAFF_SEO_CANONICAL_URL_UPDATES' , { factory : ( ) => [ ] } ) ;
8
+ const {
9
+ /**
10
+ * A multi-provider injection token for providing canonical URL update logic.
11
+ * `getData` will run in response to, and invoked with, the action specified.
12
+ */
13
+ token : DAFF_SEO_CANONICAL_URL_UPDATES ,
14
+ provider,
15
+ } = createMultiInjectionToken < DaffSeoCanonicalUrlUpdate > ( 'DAFF_SEO_CANONICAL_URL_UPDATES' ) ;
14
16
15
17
/**
16
18
* Provides canonical URL update logic.
@@ -26,9 +28,7 @@ export const DAFF_SEO_CANONICAL_URL_UPDATES = new InjectionToken<DaffSeoCanonica
26
28
* ```
27
29
*/
28
30
export function daffProvideCanonicalUrlUpdates < T extends Action = Action > ( ...values : DaffSeoCanonicalUrlUpdate < T > [ ] ) : Provider [ ] {
29
- return values . map ( value => ( {
30
- provide : DAFF_SEO_CANONICAL_URL_UPDATES ,
31
- useValue : value ,
32
- multi : true ,
33
- } ) ) ;
31
+ return provider ( ...values ) ;
34
32
}
33
+
34
+ export { DAFF_SEO_CANONICAL_URL_UPDATES } ;
Original file line number Diff line number Diff line change 1
- import {
2
- InjectionToken ,
3
- Provider ,
4
- } from '@angular/core' ;
1
+ import { Provider } from '@angular/core' ;
5
2
import { Action } from '@ngrx/store' ;
6
3
4
+ import { createMultiInjectionToken } from '@daffodil/core' ;
5
+
7
6
import { DaffSeoMetaUpdate } from '../../models/public_api' ;
8
7
9
- /**
10
- * A multi-provider injection token for providing page meta update logic.
11
- * `getData` will run in response to, and invoked with, the action specified.
12
- */
13
- export const DAFF_SEO_META_UPDATES = new InjectionToken < DaffSeoMetaUpdate [ ] > ( 'DAFF_SEO_META_UPDATES' , { factory : ( ) => [ ] } ) ;
8
+
9
+ const {
10
+ /**
11
+ * A multi-provider injection token for providing page meta update logic.
12
+ * `getData` will run in response to, and invoked with, the action specified.
13
+ */
14
+ token : DAFF_SEO_META_UPDATES ,
15
+ provider,
16
+ } = createMultiInjectionToken < DaffSeoMetaUpdate > ( 'DAFF_SEO_META_UPDATES' ) ;
14
17
15
18
/**
16
19
* Provides page meta update logic.
@@ -26,9 +29,7 @@ export const DAFF_SEO_META_UPDATES = new InjectionToken<DaffSeoMetaUpdate[]>('DA
26
29
* ```
27
30
*/
28
31
export function daffProvideMetaUpdates < T extends Action = Action > ( ...values : DaffSeoMetaUpdate < T > [ ] ) : Provider [ ] {
29
- return values . map ( value => ( {
30
- provide : DAFF_SEO_META_UPDATES ,
31
- useValue : value ,
32
- multi : true ,
33
- } ) ) ;
32
+ return provider ( ...values ) ;
34
33
}
34
+
35
+ export { DAFF_SEO_META_UPDATES } ;
Original file line number Diff line number Diff line change 1
- import {
2
- Provider ,
3
- InjectionToken ,
4
- } from '@angular/core' ;
1
+ import { Provider } from '@angular/core' ;
5
2
import { Action } from '@ngrx/store' ;
6
3
4
+ import { createMultiInjectionToken } from '@daffodil/core' ;
5
+
7
6
import { DaffSeoTitleUpdate } from '../../models/public_api' ;
8
7
9
- /**
10
- * A multi-provider injection token for providing canonical URL update logic.
11
- * `getData` will run in response to, and invoked with, the action specified.
12
- */
13
- export const DAFF_SEO_TITLE_UPDATES = new InjectionToken < DaffSeoTitleUpdate [ ] > ( 'DAFF_SEO_TITLE_UPDATES' , { factory : ( ) => [ ] } ) ;
8
+ const {
9
+ /**
10
+ * A multi-provider injection token for providing canonical URL update logic.
11
+ * `getData` will run in response to, and invoked with, the action specified.
12
+ */
13
+ token : DAFF_SEO_TITLE_UPDATES ,
14
+ provider,
15
+ } = createMultiInjectionToken < DaffSeoTitleUpdate > ( 'DAFF_SEO_TITLE_UPDATES' ) ;
14
16
15
17
/**
16
18
* Provides canonical URL update logic.
@@ -26,9 +28,7 @@ export const DAFF_SEO_TITLE_UPDATES = new InjectionToken<DaffSeoTitleUpdate[]>('
26
28
* ```
27
29
*/
28
30
export function daffProvideTitleUpdates < T extends Action = Action > ( ...values : DaffSeoTitleUpdate < T > [ ] ) : Provider [ ] {
29
- return values . map ( value => ( {
30
- provide : DAFF_SEO_TITLE_UPDATES ,
31
- useValue : value ,
32
- multi : true ,
33
- } ) ) ;
31
+ return provider ( ...values ) ;
34
32
}
33
+
34
+ export { DAFF_SEO_TITLE_UPDATES } ;
You can’t perform that action at this time.
0 commit comments