| 190 | * @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref} |
| 191 | */ |
| 192 | export function triggerRef(ref: Ref): void { |
| 193 | // ref may be an instance of ObjectRefImpl |
| 194 | if ((ref as unknown as RefImpl).dep) { |
| 195 | if (__DEV__) { |
| 196 | ;(ref as unknown as RefImpl).dep.trigger({ |
| 197 | target: ref, |
| 198 | type: TriggerOpTypes.SET, |
| 199 | key: 'value', |
| 200 | newValue: (ref as unknown as RefImpl)._value, |
| 201 | }) |
| 202 | } else { |
| 203 | ;(ref as unknown as RefImpl).dep.trigger() |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | export type MaybeRef<T = any> = |
| 209 | | T |