From 20480bf2ca0142d460a44df00c43436213bc88aa Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Wed, 23 Aug 2017 09:06:32 +0700 Subject: [PATCH 1/2] Changed toString() to help() as to not disrupt reserved keywords --- Profiler/Profiler.ts | 6 +++--- Profiler/typings.d.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Profiler/Profiler.ts b/Profiler/Profiler.ts index ca43d31..b6d3e49 100644 --- a/Profiler/Profiler.ts +++ b/Profiler/Profiler.ts @@ -39,9 +39,9 @@ export function init(): Profiler { delete Memory.profiler.start; return "Profiler stopped"; }, - - toString() { - return "Profiler.start() - Starts the profiler\n" + + + help() { + return "Profiler.start() - Starts the profiler\n" + "Profiler.stop() - Stops/Pauses the profiler\n" + "Profiler.status() - Returns whether is profiler is currently running or not\n" + "Profiler.output() - Pretty-prints the collected profiler data to the console\n" + diff --git a/Profiler/typings.d.ts b/Profiler/typings.d.ts index a022a30..999cbef 100644 --- a/Profiler/typings.d.ts +++ b/Profiler/typings.d.ts @@ -19,6 +19,7 @@ interface Profiler { start(): void; status(): void; stop(): void; + help(): void; } declare const __PROFILER_ENABLED__: boolean; From 64c17c06b4108c111261f3f2c5b469140bb8bd29 Mon Sep 17 00:00:00 2001 From: Resi Respati Date: Wed, 23 Aug 2017 09:07:35 +0700 Subject: [PATCH 2/2] added `Profiler.help()` to documentation --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c38538d..d01437e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ DesirePathProcess:findRoad 14 0.82ms 0.05 ## Setup -- Add the `Profiler` folder to your project directory somewhere. +- Add the `Profiler` folder to your project directory somewhere. - Import `Profiler` in your `main.ts` ```typescript @@ -69,7 +69,7 @@ DesirePathProcess:findRoad 14 0.82ms 0.05 public someMethod() { /* */ } } ``` - + - The script also expects a global constant `__PROFILER_ENABLED__` to be set. This is meant to be configured by build scripts. If this value is set to `false`, **Profiler** will be completely disabled on the build. ## Usage @@ -89,3 +89,5 @@ From the command line: **`Profiler.status()`** - Returns whether is profiler is currently running or not **`Profiler.output()`** - Pretty-prints the collected profiler data to the console + +**`Profiler.help()`** - Lists available profiler commands