mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Fixed return types of on(), off().
The methods on, off returns this, Benchmark or Benchmark.Suite respectively.
This commit is contained in:
parent
a8e88654be
commit
c3b8d5b4cf
@ -229,6 +229,27 @@ suite.add({
|
||||
'onComplete': onComplete
|
||||
});
|
||||
|
||||
// unregister a listener for an event type
|
||||
suite.off('cycle', listener) as Benchmark.Suite;
|
||||
|
||||
// unregister a listener for multiple event types
|
||||
suite.off('start cycle', listener) as Benchmark.Suite;
|
||||
|
||||
// unregister all listeners for an event type
|
||||
suite.off('cycle') as Benchmark.Suite;
|
||||
|
||||
// unregister all listeners for multiple event types
|
||||
suite.off('start cycle complete') as Benchmark.Suite;
|
||||
|
||||
// unregister all listeners for all event types
|
||||
suite.off() as Benchmark.Suite;
|
||||
|
||||
// register a listener for an event type
|
||||
suite.on('cycle', listener) as Benchmark.Suite;
|
||||
|
||||
// register a listener for multiple event types
|
||||
suite.on('start cycle', listener) as Benchmark.Suite;
|
||||
|
||||
// basic usage
|
||||
suite.run();
|
||||
|
||||
|
||||
8
types/benchmark/index.d.ts
vendored
8
types/benchmark/index.d.ts
vendored
@ -170,10 +170,10 @@ declare namespace Benchmark {
|
||||
join(separator?: string): string;
|
||||
listeners(type: string): Function[];
|
||||
map(callback: Function): any[];
|
||||
off(type?: string, callback?: Function): Benchmark;
|
||||
off(types: string[]): Benchmark;
|
||||
on(type?: string, callback?: Function): Benchmark;
|
||||
on(types: string[]): Benchmark;
|
||||
off(type?: string, callback?: Function): Suite;
|
||||
off(types: string[]): Suite;
|
||||
on(type?: string, callback?: Function): Suite;
|
||||
on(types: string[]): Suite;
|
||||
pluck(property: string): any[];
|
||||
pop(): Function;
|
||||
push(benchmark: Benchmark): number;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user