class BaseReactiveHandler implements ProxyHandler<Target> {
constructor(
protected readonly _isReadonly = false,
- protected readonly _shallow = false,
+ protected readonly _isShallow = false,
) {}
get(target: Target, key: string | symbol, receiver: object) {
const isReadonly = this._isReadonly,
- shallow = this._shallow
+ isShallow = this._isShallow
if (key === ReactiveFlags.IS_REACTIVE) {
return !isReadonly
} else if (key === ReactiveFlags.IS_READONLY) {
return isReadonly
} else if (key === ReactiveFlags.IS_SHALLOW) {
- return shallow
+ return isShallow
} else if (key === ReactiveFlags.RAW) {
if (
receiver ===
(isReadonly
- ? shallow
+ ? isShallow
? shallowReadonlyMap
: readonlyMap
- : shallow
+ : isShallow
? shallowReactiveMap
: reactiveMap
).get(target) ||
track(target, TrackOpTypes.GET, key)
}
- if (shallow) {
+ if (isShallow) {
return res
}
}
class MutableReactiveHandler extends BaseReactiveHandler {
- constructor(shallow = false) {
- super(false, shallow)
+ constructor(isShallow = false) {
+ super(false, isShallow)
}
set(
receiver: object,
): boolean {
let oldValue = (target as any)[key]
- if (!this._shallow) {
+ if (!this._isShallow) {
const isOldValueReadonly = isReadonly(oldValue)
if (!isShallow(value) && !isReadonly(value)) {
oldValue = toRaw(oldValue)
}
class ReadonlyReactiveHandler extends BaseReactiveHandler {
- constructor(shallow = false) {
- super(true, shallow)
+ constructor(isShallow = false) {
+ super(true, isShallow)
}
set(target: object, key: string | symbol) {