Skip to content

Commit

Permalink
chore(reactivity): consistent variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
OnlyWick committed Feb 17, 2024
1 parent 272ab9f commit ba38c16
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/reactivity/src/baseHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,26 @@ function hasOwnProperty(this: object, key: string) {
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) ||
Expand Down Expand Up @@ -143,7 +143,7 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
track(target, TrackOpTypes.GET, key)
}

if (shallow) {
if (isShallow) {
return res
}

Expand All @@ -164,8 +164,8 @@ class BaseReactiveHandler implements ProxyHandler<Target> {
}

class MutableReactiveHandler extends BaseReactiveHandler {
constructor(shallow = false) {
super(false, shallow)
constructor(isShallow = false) {
super(false, isShallow)
}

set(
Expand All @@ -175,7 +175,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
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)
Expand Down

0 comments on commit ba38c16

Please sign in to comment.