Function
clear
(this: IterableCollections)
Source from the content-addressed store, hash-verified
| 230 | return result |
| 231 | }, |
| 232 | clear(this: IterableCollections) { |
| 233 | const target = toRaw(this) |
| 234 | const hadItems = target.size !== 0 |
| 235 | const oldTarget = __DEV__ |
| 236 | ? isMap(target) |
| 237 | ? new Map(target) |
| 238 | : new Set(target) |
| 239 | : undefined |
| 240 | // forward the operation before queueing reactions |
| 241 | const result = target.clear() |
| 242 | if (hadItems) { |
| 243 | trigger( |
| 244 | target, |
| 245 | TriggerOpTypes.CLEAR, |
| 246 | undefined, |
| 247 | undefined, |
| 248 | oldTarget, |
| 249 | ) |
| 250 | } |
| 251 | return result |
| 252 | }, |
| 253 | }, |
| 254 | ) |
| 255 | |
Callers
nothing calls this directly
Tested by
no test coverage detected