Skip to content

Commit

Permalink
feat(core): mark core signal APIs as stable (angular#51821)
Browse files Browse the repository at this point in the history
This change marks core signal APIs as stable and exit
developer preview for the main signal building blocks.

PR Close angular#51821
  • Loading branch information
pkozlowski-opensource authored and atscott committed Oct 5, 2023
1 parent c7ff9df commit 5b88d13
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 20 deletions.
8 changes: 0 additions & 8 deletions packages/core/src/signals/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,20 @@ export const SIGNAL = /* @__PURE__ */ Symbol('SIGNAL');
* call it.
*
* Ordinary values can be turned into `Signal`s with the `signal` function.
*
* @developerPreview
*/
export type Signal<T> = (() => T)&{
[SIGNAL]: unknown;
};

/**
* Checks if the given `value` is a reactive `Signal`.
*
* @developerPreview
*/
export function isSignal(value: unknown): value is Signal<unknown> {
return typeof value === 'function' && (value as Signal<unknown>)[SIGNAL] !== undefined;
}

/**
* A comparison function which can determine if two values are equal.
*
* @developerPreview
*/
export type ValueEqualityFn<T> = (a: T, b: T) => boolean;

Expand All @@ -49,8 +43,6 @@ export type ValueEqualityFn<T> = (a: T, b: T) => boolean;
*
* This allows signals to hold non-primitive values (arrays, objects, other collections) and still
* propagate change notification upon explicit mutation without identity change.
*
* @developerPreview
*/
export function defaultEquals<T>(a: T, b: T) {
return Object.is(a, b);
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/signals/src/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {consumerAfterComputation, consumerBeforeComputation, producerAccessed, p

/**
* Options passed to the `computed` creation function.
*
* @developerPreview
*/
export interface CreateComputedOptions<T> {
/**
Expand All @@ -23,8 +21,6 @@ export interface CreateComputedOptions<T> {

/**
* Create a computed `Signal` which derives a reactive value from an expression.
*
* @developerPreview
*/
export function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {
const node: ComputedNode<T> = Object.create(COMPUTED_NODE);
Expand Down
6 changes: 0 additions & 6 deletions packages/core/src/signals/src/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ let postSignalSetFn: (() => void)|null = null;

/**
* A `Signal` with a value that can be mutated via a setter interface.
*
* @developerPreview
*/
export interface WritableSignal<T> extends Signal<T> {
/**
Expand All @@ -45,8 +43,6 @@ export interface WritableSignal<T> extends Signal<T> {

/**
* Options passed to the `signal` creation function.
*
* @developerPreview
*/
export interface CreateSignalOptions<T> {
/**
Expand All @@ -58,8 +54,6 @@ export interface CreateSignalOptions<T> {

/**
* Create a `Signal` that can be set or updated directly.
*
* @developerPreview
*/
export function signal<T>(initialValue: T, options?: CreateSignalOptions<T>): WritableSignal<T> {
const node: SignalNode<T> = Object.create(SIGNAL_NODE);
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/signals/src/untracked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {setActiveConsumer} from './graph';
/**
* Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
* can, optionally, return a value.
*
* @developerPreview
*/
export function untracked<T>(nonReactiveReadsFn: () => T): T {
const prevConsumer = setActiveConsumer(null);
Expand Down

0 comments on commit 5b88d13

Please sign in to comment.