mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): export additional methods from primitives/signals (#56759)
Export `producerIncrementEpoch` which was missing before, as well as a new `runPostSignalSetFn` helper. These changes make it easier to write `signal`- like utilities which don't use the `createSignal` abstraction. PR Close #56759
This commit is contained in:
parent
5cb1dd7697
commit
4267082c8e
3 changed files with 12 additions and 0 deletions
|
|
@ -52,6 +52,9 @@ export function isReactive(value: unknown): value is Reactive;
|
|||
// @public
|
||||
export function producerAccessed(node: ReactiveNode): void;
|
||||
|
||||
// @public
|
||||
export function producerIncrementEpoch(): void;
|
||||
|
||||
// @public
|
||||
export function producerNotifyConsumers(node: ReactiveNode): void;
|
||||
|
||||
|
|
@ -92,6 +95,9 @@ export interface ReactiveNode {
|
|||
version: Version;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export function runPostSignalSetFn(): void;
|
||||
|
||||
// @public (undocumented)
|
||||
export function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export {
|
|||
isInNotificationPhase,
|
||||
isReactive,
|
||||
producerAccessed,
|
||||
producerIncrementEpoch,
|
||||
producerNotifyConsumers,
|
||||
producerUpdateValueVersion,
|
||||
producerUpdatesAllowed,
|
||||
|
|
@ -33,6 +34,7 @@ export {
|
|||
SignalGetter,
|
||||
SignalNode,
|
||||
createSignal,
|
||||
runPostSignalSetFn,
|
||||
setPostSignalSetFn,
|
||||
signalSetFn,
|
||||
signalUpdateFn,
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ export function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T)
|
|||
signalSetFn(node, updater(node.value));
|
||||
}
|
||||
|
||||
export function runPostSignalSetFn(): void {
|
||||
postSignalSetFn?.();
|
||||
}
|
||||
|
||||
// Note: Using an IIFE here to ensure that the spread assignment is not considered
|
||||
// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.
|
||||
// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.
|
||||
|
|
|
|||
Loading…
Reference in a new issue