Permalink
Browse files

Make waitForNavigation returned response optional

Make the promise returned by waitForNavigation yield an option
converted from the nullable response we get from JS. Puppeteer docs
previously did not indicate that the response could be null.

Fixes #63.
  • Loading branch information...
zploskey committed Jul 3, 2018
1 parent e43b8b5 commit 5a62dad37187c01658b76a0f3262268bf0cf8e72
Showing with 12 additions and 1 deletion.
  1. +7 −0 lib/js/src/Page.js
  2. +5 −1 src/Page.re

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -311,7 +311,11 @@ external setViewport : (~viewport: viewport) => Js.Promise.t(unit) = "";

[@bs.send.pipe: t]
external waitForNavigation :
(~options: Navigation.options) => Js.Promise.t(Response.t) =
(~options: Navigation.options) => Js.Promise.t(Js.nullable(Response.t)) =
"";

let waitForNavigation = (~options, page) =>
waitForNavigation(~options, page)
|> Js.Promise.(then_(response => response |> Js.toOption |> resolve));

[@bs.send] external workers : t => array(Worker.t) = "";

0 comments on commit 5a62dad

Please sign in to comment.