Added type definition for function "pdf()" with buffer in callback.

This commit is contained in:
Bleser
2018-03-20 16:04:55 +05:00
parent 710943739f
commit 5e48bc7dcd
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -107,6 +107,7 @@ declare class Nightmare {
html(path: string, saveType: 'MHTML'): Nightmare;
pdf(path: string): Nightmare;
pdf(path: string, options: Object): Nightmare;
pdf(cd:(err:Error, data:Buffer)=>void): Nightmare;
title(): string;
title(cb: (title: string) => void): Nightmare;
url(cb: (url: string) => void): Nightmare;
+8
View File
@@ -189,6 +189,14 @@ new Nightmare()
.pdf('test/test.pdf')
.run(done);
new Nightmare()
.goto("http://yahoo.com")
.pdf((err,data)=>{
console.log(Buffer.isBuffer(data))
})
.run(done)
new Nightmare()
.goto('http://www.google.com/')
.wait('input')