chore: trim non-public properties on EffectScope type

This commit is contained in:
Evan You 2022-04-12 15:56:57 +08:00
parent f44087e171
commit ea6fc845f2

View File

@ -4,21 +4,33 @@ import { warn } from './warning'
let activeEffectScope: EffectScope | undefined let activeEffectScope: EffectScope | undefined
export class EffectScope { export class EffectScope {
/**
* @internal
*/
active = true active = true
/**
* @internal
*/
effects: ReactiveEffect[] = [] effects: ReactiveEffect[] = []
/**
* @internal
*/
cleanups: (() => void)[] = [] cleanups: (() => void)[] = []
/** /**
* only assinged by undetached scope * only assinged by undetached scope
* @internal
*/ */
parent: EffectScope | undefined parent: EffectScope | undefined
/** /**
* record undetached scopes * record undetached scopes
* @internal
*/ */
scopes: EffectScope[] | undefined scopes: EffectScope[] | undefined
/** /**
* track a child scope's index in its parent's scopes array for optimized * track a child scope's index in its parent's scopes array for optimized
* removal * removal
* @internal
*/ */
private index: number | undefined private index: number | undefined
@ -46,10 +58,18 @@ export class EffectScope {
} }
} }
/**
* This should only be called on non-detached scopes
* @internal
*/
on() { on() {
activeEffectScope = this activeEffectScope = this
} }
/**
* This should only be called on non-detached scopes
* @internal
*/
off() { off() {
activeEffectScope = this.parent activeEffectScope = this.parent
} }