From ddc59b247282774ccc53e3cc925efc30d4e25675 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 25 Jan 2018 14:50:42 -0800 Subject: [PATCH] docs(api.md): fix exposeFunction example (#1900) --- docs/api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api.md b/docs/api.md index 295d0c2c01c..5529d1491f1 100644 --- a/docs/api.md +++ b/docs/api.md @@ -806,7 +806,7 @@ const crypto = require('crypto'); puppeteer.launch().then(async browser => { const page = await browser.newPage(); - page.on('console', msg => console.log(msg.text)); + page.on('console', msg => console.log(msg.text())); await page.exposeFunction('md5', text => crypto.createHash('md5').update(text).digest('hex') ); @@ -828,7 +828,7 @@ const fs = require('fs'); puppeteer.launch().then(async browser => { const page = await browser.newPage(); - page.on('console', msg => console.log(msg.text)); + page.on('console', msg => console.log(msg.text())); await page.exposeFunction('readfile', async filePath => { return new Promise((resolve, reject) => { fs.readFile(filePath, 'utf8', (err, text) => {