Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 101x 101x 1441x 1441x 1441x 1441x 6416x 5373x 101x 2757x 1023x 1829x 101x 2757x 2757x 1933x 1933x 3289x 3289x 162x 3127x 3289x 3289x 1933x | import { ReactiveEffect, trackOpBit } from './effect' export type Dep = Set<ReactiveEffect> & TrackedMarkers /** * wasTracked and newTracked maintain the status for several levels of effect * tracking recursion. One bit per level is used to define whether the dependency * was/is tracked. */ type TrackedMarkers = { /** * wasTracked */ w: number /** * newTracked */ n: number } export const createDep = (effects?: ReactiveEffect[]): Dep => { const dep = new Set<ReactiveEffect>(effects) as Dep dep.w = 0 dep.n = 0 return dep } export const wasTracked = (dep: Dep): boolean => (dep.w & trackOpBit) > 0 export const newTracked = (dep: Dep): boolean => (dep.n & trackOpBit) > 0 export const initDepMarkers = ({ deps }: ReactiveEffect) => { if (deps.length) { for (let i = 0; i < deps.length; i++) { deps[i].w |= trackOpBit // set was tracked } } } export const finalizeDepMarkers = (effect: ReactiveEffect) => { const { deps } = effect if (deps.length) { let ptr = 0 for (let i = 0; i < deps.length; i++) { const dep = deps[i] if (wasTracked(dep) && !newTracked(dep)) { dep.delete(effect) } else { deps[ptr++] = dep } // clear bits dep.w &= ~trackOpBit dep.n &= ~trackOpBit } deps.length = ptr } } |