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.
|
* 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.
|
* @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.
|
* Prints the timer for all methods instrumented with profile decorator.
|
||||||
|
|||||||
@@ -49,9 +49,8 @@ export function start(name: string): void {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let info: TimerInfo;
|
let info = timers.get(name);
|
||||||
if (timers.has(name)) {
|
if (info) {
|
||||||
info = timers.get(name);
|
|
||||||
if (info.isRunning) {
|
if (info.isRunning) {
|
||||||
throw new Error(`Timer already running: ${name}`);
|
throw new Error(`Timer already running: ${name}`);
|
||||||
}
|
}
|
||||||
@@ -107,11 +106,10 @@ function pauseInternal(name: string): TimerInfo {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function profile(name?: string): (target, key, descriptor) => void {
|
export function profile(name?: string): MethodDecorator {
|
||||||
return (target, key, descriptor) => {
|
return (target, key, descriptor) => {
|
||||||
if (!ENABLED) {
|
if (!ENABLED) {
|
||||||
// Return the original descriptor if not enabled
|
return;
|
||||||
return descriptor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// save a reference to the original method this way we keep the values currently in the
|
// save a reference to the original method this way we keep the values currently in the
|
||||||
|
|||||||
Reference in New Issue
Block a user