MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / profileMethodUnnamed

Function profileMethodUnnamed

packages/core/profiling/index.ts:182–202  ·  view source on GitHub ↗
(target: Object, key: symbol | string, descriptor)

Source from the content-addressed store, hash-verified

180}
181
182const profileMethodUnnamed = (target: Object, key: symbol | string, descriptor) => {
183 // save a reference to the original method this way we keep the values currently in the
184 // descriptor and don't overwrite what another decorator might have done to the descriptor.
185 if (descriptor === undefined) {
186 descriptor = Object.getOwnPropertyDescriptor(target, key);
187 }
188 const originalMethod = descriptor.value;
189
190 let className = '';
191 if (target && target.constructor && target.constructor.name) {
192 className = target.constructor.name + '.';
193 }
194
195 const name = className + key?.toString();
196
197 //editing the descriptor/value parameter
198 descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Instance);
199
200 // return edited descriptor as opposed to overwriting the descriptor
201 return descriptor;
202};
203
204const profileStaticMethodUnnamed = <F extends Function>(ctor: F, key: symbol | string, descriptor) => {
205 // save a reference to the original method this way we keep the values currently in the

Callers 1

profileFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected