browserless 9.8.4 → 9.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +6 -5
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "browserless",
3
3
  "description": "The headless Chrome/Chromium performance driver for Node.js",
4
4
  "homepage": "https://browserless.js.org",
5
- "version": "9.8.4",
5
+ "version": "9.9.1",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -62,5 +62,5 @@
62
62
  "timeout": "30s",
63
63
  "verbose": true
64
64
  },
65
- "gitHead": "cd2a76f7ffaa3fbe676796b8777debe9a65d1961"
65
+ "gitHead": "74492aaa5c4e5004a32b3b75c62f14efca0a43af"
66
66
  }
package/src/index.js CHANGED
@@ -107,7 +107,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
107
107
  }
108
108
  }
109
109
 
110
- const wrapError = (fn, { timeout: evaluateTimeout } = {}) => async (...args) => {
110
+ const withPage = (fn, { timeout: evaluateTimeout } = {}) => async (...args) => {
111
111
  let isRejected = false
112
112
 
113
113
  async function run () {
@@ -149,7 +149,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
149
149
  }
150
150
 
151
151
  const evaluate = (fn, gotoOpts) =>
152
- wrapError(
152
+ withPage(
153
153
  page => async (url, opts) => {
154
154
  const { response, error } = await goto(page, { url, ...gotoOpts, ...opts })
155
155
  return fn(page, response, error)
@@ -174,11 +174,12 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
174
174
  goto,
175
175
  html: evaluate(page => page.content(), { animations: true }),
176
176
  page: createPage,
177
- pdf: wrapError(createPdf({ goto })),
178
- screenshot: wrapError(createScreenshot({ goto })),
177
+ pdf: withPage(createPdf({ goto })),
178
+ screenshot: withPage(createScreenshot({ goto })),
179
179
  text: evaluate(page => page.evaluate(() => document.body.innerText)),
180
180
  getDevice: goto.getDevice,
181
- destroyContext
181
+ destroyContext,
182
+ withPage
182
183
  }
183
184
  }
184
185