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

Function profileStaticMethodUnnamed

packages/core/profiling/index.ts:204–223  ·  view source on GitHub ↗
(ctor: F, key: symbol | string, descriptor)

Source from the content-addressed store, hash-verified

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
206 // descriptor and don't overwrite what another decorator might have done to the descriptor.
207 if (descriptor === undefined) {
208 descriptor = Object.getOwnPropertyDescriptor(ctor, key);
209 }
210 const originalMethod = descriptor.value;
211
212 let className = '';
213 if (ctor && ctor.name) {
214 className = ctor.name + '.';
215 }
216 const name = className + key?.toString();
217
218 //editing the descriptor/value parameter
219 descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Static);
220
221 // return edited descriptor as opposed to overwriting the descriptor
222 return descriptor;
223};
224
225function profileMethodNamed(name: string): MethodDecorator {
226 return (target, key, descriptor: PropertyDescriptor) => {

Callers 1

profileFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected