| 196 | ): WritableComputedRef<T, S> |
| 197 | /*@__NO_SIDE_EFFECTS__*/ |
| 198 | export function computed<T>( |
| 199 | getterOrOptions: ComputedGetter<T> | WritableComputedOptions<T>, |
| 200 | debugOptions?: DebuggerOptions, |
| 201 | isSSR = false, |
| 202 | ) { |
| 203 | let getter: ComputedGetter<T> |
| 204 | let setter: ComputedSetter<T> | undefined |
| 205 | |
| 206 | if (isFunction(getterOrOptions)) { |
| 207 | getter = getterOrOptions |
| 208 | } else { |
| 209 | getter = getterOrOptions.get |
| 210 | setter = getterOrOptions.set |
| 211 | } |
| 212 | |
| 213 | const cRef = new ComputedRefImpl(getter, setter, isSSR) |
| 214 | |
| 215 | if (__DEV__ && debugOptions && !isSSR) { |
| 216 | cRef.onTrack = debugOptions.onTrack |
| 217 | cRef.onTrigger = debugOptions.onTrigger |
| 218 | } |
| 219 | |
| 220 | return cRef as any |
| 221 | } |