Module: profiler

Members

(private, inner) noopProfiler :Profiler

Default profiler("...") returned object when profile mode is disabled.

Type:
  • Profiler
Source:

Methods

(inner) enableProfiling(enable, reporternullable)

Enable or disable profiling

Parameters:
Name Type Attributes Description
enable bool

the profiling is enabled. If true it will create a PerformanceObserver and start observing, profiler() will then create a proper profiler object. If false, observing is cancelled and the profiler object will be a noop.

reporter function <nullable>

The reporter function called by the observer. If falsy, the default reporter will be used.

Source:

(private, inner) profiler(id) → {Profiler}

Create a profiler object with start() mark() and end() methods to either start, keep marking a specific profiled name, or ending it.

Parameters:
Name Type Description
id string

the unique ID to profile.

Source:
Returns:

The profiler with start(), mark() and end(clear = false) methods.

Type
Profiler
Example
let {mark, end} = profiler('console.log');
mark();
console.log(1, 2, 3);
end();