import Dep from './dep'; import { SimpleSet } from "../shared/env"; export interface WatcherOptions { deep?: boolean; lazy?: boolean; sync?: boolean; before?: Function; } export default class Watcher { vm: any; id: number; expression: string; cb: Function; deep: boolean; lazy: boolean; sync: boolean; dirty: boolean; deps: Array; newDeps: Array; depIds: SimpleSet; newDepIds: SimpleSet; getter: Function; value: any; before: Function; active: boolean; constructor(vm: any, expOrFn: string | Function, cb: Function, options?: WatcherOptions); /** * Evaluate the getter, and re-collect dependencies. */ get(): any; addDep(dep: Dep): void; /** * Clean up for dependency collection. */ cleanupDeps(): void; /** * Subscriber interface. * Will be called when a dependency changes. */ update(): void; /** * Scheduler job interface. * Will be called by the scheduler. */ run(): void; /** * Evaluate the value of the watcher. * This only gets called for lazy watchers. */ evaluate(): void; /** * Depend on all deps collected by this watcher. */ depend(): void; }