szmarczak / http-timer

🕐 Performance timings for HTTP requests
MIT License
192 stars 18 forks source link

Use `emitter.prependOnceListener(eventName, listener)` #7

Closed szmarczak closed 5 years ago

szmarczak commented 5 years ago

See https://github.com/sindresorhus/got/issues/874

Just need to replace every .once with .prependOnceListener and do some basic test:

test('prepends once listener', t => {
    ...
    const timings = timer(request);
    request.once('response' => {
        t.true(typeof timings.response === 'number');
    });
    ...
});