(computation: () => T, options?: CreateComputedOptions<T>)
| 30 | * @see [Computed signals](guide/signals#computed-signals) |
| 31 | */ |
| 32 | export 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 | } |
searching dependent graphs…