Skip to content

Commit

Permalink
feat: Rename some API parameters (#130)
Browse files Browse the repository at this point in the history
* Renamed disableAnimations to animations

* renamed media to mediaType. This fixes #129

* renamed disableJavaScript to javascript. This fixes #126

* Update index.js

Co-authored-by: Kiko Beats <josefrancisco.verdu@gmail.com>
  • Loading branch information
adityawankhede5 and Kikobeats committed Jan 24, 2020
1 parent 64fa0bf commit c649ab3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/goto/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ module.exports = ({ timeout, ...deviceOpts }) => {

const goto = async (
page,
{ url, media, adblock = true, headers = {}, waitFor = 0, disableAnimations = true, disableJavaScript = false, ...args }
{ url, mediaType, adblock = true, headers = {}, waitFor = 0, animations = true, javascript = true, ...args }
) => {
if (adblock) {
await engine.enableBlockingInPage(page)
}

if (disableJavaScript) {
if (javascript === false) {
await page.setJavaScriptEnabled(false)
}

Expand All @@ -89,17 +89,17 @@ module.exports = ({ timeout, ...deviceOpts }) => {
await page.setViewport(device.viewport)
}

if (media) {
await page.emulateMediaType(media)
if (mediaType) {
await page.emulateMediaType(mediaType)
}

const task = () => page.goto(url, args)

const { isFulfilled, value: response } = await pReflect(pTimeout(task(), gotoTimeout))

if (isFulfilled) {
if (disableAnimations) {
debug({ disableAnimations })
if (animations) {
debug({ animations })
await page.evaluate(doDisableAnimations)
}

Expand Down

0 comments on commit c649ab3

Please sign in to comment.