MCPcopy
hub / github.com/angular/angular / computed

Function computed

packages/core/src/render3/reactivity/computed.ts:32–42  ·  view source on GitHub ↗
(computation: () => T, options?: CreateComputedOptions<T>)

Source from the content-addressed store, hash-verified

30 * @see [Computed signals](guide/signals#computed-signals)
31 */
32export function computed<T>(computation: () => T, options?: CreateComputedOptions<T>): Signal<T> {
33 const getter = createComputed(computation, options?.equal);
34
35 if (typeof ngDevMode !== 'undefined' && ngDevMode) {
36 const debugName = options?.debugName;
37 getter[SIGNAL].debugName = debugName;
38 getter.toString = () => `[Computed${debugName ? ' (' + debugName + ')' : ''}: ${getter()}]`;
39 }
40
41 return getter;
42}

Callers 15

to_signal_spec.tsFile · 0.90
toSignalFunction · 0.90
debounce_spec.tsFile · 0.90
resource_spec.tsFile · 0.90
WriteComputedClass · 0.90
reactivity_spec.tsFile · 0.90
watch_spec.tsFile · 0.90
signal_spec.tsFile · 0.90

Calls 2

createComputedFunction · 0.90
getterFunction · 0.85

Tested by 3

constructorMethod · 0.72
constructorMethod · 0.72
narrowedFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…