Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed toString() to help() as to not disrupt reserved keywords #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Profiler/Profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
Expand Down
1 change: 1 addition & 0 deletions Profiler/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface Profiler {
start(): void;
status(): void;
stop(): void;
help(): void;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be help(): string; ?

}

declare const __PROFILER_ENABLED__: boolean;
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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