Skip to content

Commit 79ed9b7

Browse files
committed
refactor(state): deprecate factory
1 parent b6d4e7a commit 79ed9b7

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

libs/state/actions/src/lib/actions.factory.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
import { ErrorHandler, inject, Injectable, OnDestroy } from '@angular/core';
22
import { Subject } from 'rxjs';
33
import { actionProxyHandler } from './proxy';
4-
import {
5-
Actions,
6-
ActionTransforms,
7-
EffectMap,
8-
RxActions,
9-
ValuesOf,
10-
} from './types';
4+
import { Actions, ActionTransforms, EffectMap, RxActions } from './types';
115

126
type SubjectMap<T> = { [K in keyof T]: Subject<T[K]> };
137

148
/**
159
* @deprecated - use rxActions instead
1610
*
1711
* This class creates RxActions bound to Angular's DI life-cycles. This prevents memory leaks and optionally makes the instance reusable across the app.
18-
* The main function here is called `create`, optionally you can also call `destroy` to complete all action channels.
12+
* The function has to be used inside an injection context.
1913
* If the consumer gets destroyed also the actions get destroyed automatically.
2014
*
2115
* @example
22-
* const factory = new RxActionFactory<{search: string}>();
23-
* const actions = factory.create();
24-
* actions.search('');
25-
* actions.search$.subscribe();
16+
* @Component({
17+
* standalone: true,
18+
* template: `...`,
19+
* })
20+
* export class AnyComponent {
21+
* ui = rxActions<{search: string, refresh: void}>();
22+
* }
2623
*/
2724
@Injectable()
2825
export class RxActionFactory<T extends Partial<Actions>> implements OnDestroy {

0 commit comments

Comments
 (0)