mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
allow method chaining with .on()
This commit is contained in:
@@ -197,3 +197,10 @@ r.post(str);
|
||||
r(options);
|
||||
r.get(options);
|
||||
r.post(options);
|
||||
|
||||
request
|
||||
.get('http://example.com/example.png')
|
||||
.on('response', function(response) {
|
||||
// check response
|
||||
})
|
||||
.pipe(request.put('http://another.com/another.png'));
|
||||
|
||||
2
request/request.d.ts
vendored
2
request/request.d.ts
vendored
@@ -110,6 +110,8 @@ declare module 'request' {
|
||||
oauth(oauth: OAuthOptions): Request;
|
||||
jar(jar: CookieJar): Request;
|
||||
|
||||
on(event: string, listener: Function): Request;
|
||||
|
||||
write(buffer: Buffer, cb?: Function): boolean;
|
||||
write(str: string, cb?: Function): boolean;
|
||||
write(str: string, encoding: string, cb?: Function): boolean;
|
||||
|
||||
Reference in New Issue
Block a user