MCPcopy Create free account
hub / github.com/angular/angular / once

Function once

packages/zone.js/lib/common/promise.ts:119–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117 }
118
119 const once = function () {
120 let wasCalled = false;
121
122 return function wrapper(wrappedFunction: Function) {
123 return function () {
124 if (wasCalled) {
125 return;
126 }
127 wasCalled = true;
128 wrappedFunction.apply(null, arguments);
129 };
130 };
131 };
132
133 const TYPE_ERROR = 'Promise resolved with itself';
134 const CURRENT_TASK_TRACE_SYMBOL = __symbol__('currentTaskTrace');

Callers 2

resolvePromiseFunction · 0.85
constructorMethod · 0.85

Calls 1

applyMethod · 0.65

Tested by

no test coverage detected