MCPcopy
hub / github.com/angular/angular / setDelegate

Method setDelegate

packages/zone.js/lib/zone-spec/proxy.ts:60–77  ·  view source on GitHub ↗
(delegateSpec: ZoneSpec | null)

Source from the content-addressed store, hash-verified

58 }
59
60 setDelegate(delegateSpec: ZoneSpec | null) {
61 const isNewDelegate = this._delegateSpec !== delegateSpec;
62 this._delegateSpec = delegateSpec;
63 this.propertyKeys && this.propertyKeys.forEach((key) => delete this.properties[key]);
64 this.propertyKeys = null;
65 if (delegateSpec && delegateSpec.properties) {
66 this.propertyKeys = Object.keys(delegateSpec.properties);
67 this.propertyKeys.forEach((k) => (this.properties[k] = delegateSpec.properties![k]));
68 }
69 // if a new delegateSpec was set, check if we need to trigger hasTask
70 if (
71 isNewDelegate &&
72 this.lastTaskState &&
73 (this.lastTaskState.macroTask || this.lastTaskState.microTask)
74 ) {
75 this.isNeedToTriggerHasTask = true;
76 }
77 }
78
79 getDelegate() {
80 return this._delegateSpec;

Callers 7

constructorMethod · 0.95
resetDelegateMethod · 0.95
runInTestZoneFunction · 0.80
fakeAsyncFnFunction · 0.80
testFnFunction · 0.80
async-test.spec.tsFile · 0.80
proxy.spec.tsFile · 0.80

Calls 2

keysMethod · 0.65
forEachMethod · 0.45

Tested by 1

testFnFunction · 0.64