mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixes
This commit is contained in:
2
tns-core-modules/profiling/profiling.d.ts
vendored
2
tns-core-modules/profiling/profiling.d.ts
vendored
@@ -53,7 +53,7 @@ export declare function stop(name: string): TimerInfo;
|
||||
* Works only if profiling is enabled.
|
||||
* @param name Name of the timer which will be used for method calls. If not provided - the name of the method will be used.
|
||||
*/
|
||||
export declare function profile(name?: string): (target, key, descriptor) => void;
|
||||
export declare function profile(name?: string): MethodDecorator;
|
||||
|
||||
/**
|
||||
* Prints the timer for all methods instrumented with profile decorator.
|
||||
|
||||
@@ -49,9 +49,8 @@ export function start(name: string): void {
|
||||
return;
|
||||
}
|
||||
|
||||
let info: TimerInfo;
|
||||
if (timers.has(name)) {
|
||||
info = timers.get(name);
|
||||
let info = timers.get(name);
|
||||
if (info) {
|
||||
if (info.isRunning) {
|
||||
throw new Error(`Timer already running: ${name}`);
|
||||
}
|
||||
@@ -107,11 +106,10 @@ function pauseInternal(name: string): TimerInfo {
|
||||
return info;
|
||||
}
|
||||
|
||||
export function profile(name?: string): (target, key, descriptor) => void {
|
||||
export function profile(name?: string): MethodDecorator {
|
||||
return (target, key, descriptor) => {
|
||||
if (!ENABLED) {
|
||||
// Return the original descriptor if not enabled
|
||||
return descriptor;
|
||||
return;
|
||||
}
|
||||
|
||||
// save a reference to the original method this way we keep the values currently in the
|
||||
|
||||
Reference in New Issue
Block a user