Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/common/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,6 +158,11 @@ export function patchProperty(obj: any, prop: string, prototype?: any) {
return;
}

const onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
return;
}

// A property descriptor cannot have getter/setter and be writable
// deleting the writable and value properties avoids this error:
//
Expand DownExpand Up@@ -240,6 +245,8 @@ export function patchProperty(obj: any, prop: string, prototype?: any) {
};

ObjectDefineProperty(obj, prop, desc);

obj[onPropPatchedSymbol] = true;
}

export function patchOnProperties(obj: any, properties: string[]|null, prototype?: any) {
Expand Down