Permalink
Browse files

Use Node.Buffer.t instead of Typed_array

Node.Buffer seems to work well enough now, so we can use it.
  • Loading branch information...
zploskey committed Jun 14, 2018
1 parent 553935f commit 5c7ae0d085e6c0e41bd120943c4401e112dbd835
Showing with 12 additions and 20 deletions.
  1. +4 −2 __tests__/puppeteer_test.re
  2. +2 −2 lib/js/__tests__/puppeteer_test.js
  3. +1 −2 src/ElementHandle.re
  4. +2 −4 src/Page.re
  5. +3 −10 src/Tracing.re
@@ -283,7 +283,8 @@ describe("Page", () => {
|> Page.screenshot()
|> then_(buf =>
buf
|> Js_typed_array.ArrayBuffer.byteLength
|> Node.Buffer.toString
|> String.length
|> expect
|> toBeGreaterThanOrEqual(3236)
|> resolve
@@ -589,7 +590,8 @@ describe("Page", () => {
)
|> then_(buffer =>
buffer
|> Js_typed_array.ArrayBuffer.byteLength
|> Node.Buffer.toString
|> String.length
|> expect
|> toBeGreaterThan(20000)
|> Js.Promise.resolve

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

Oops, something went wrong.
@@ -34,8 +34,7 @@ external press :

[@bs.send.pipe: t]
external screenshot :
(~options: Screenshot.options=?, unit) =>
Js.Promise.t(Js.Typed_array.ArrayBuffer.t) =
(~options: Screenshot.options=?, unit) => Js.Promise.t(Node.Buffer.t) =
"";

[@bs.send.pipe: t]
@@ -208,8 +208,7 @@ external mouse : t => Mouse.t = "";

[@bs.send.pipe: t]
external screenshot :
(~options: Screenshot.options=?, unit) =>
Js.Promise.t(Js.Typed_array.ArrayBuffer.t) =
(~options: Screenshot.options=?, unit) => Js.Promise.t(Node.Buffer.t) =
"";

[@bs.send.pipe: t]
@@ -241,9 +240,8 @@ external emulateMediaDisable :
([@bs.as {json|null|json}] _) => Js.Promise.t(unit) =
"emulateMedia";

/* TODO: change return type to "Node.buffer" when its ready */
[@bs.send.pipe: t]
external pdf : pdfOptions => Js.Promise.t(Js_typed_array.ArrayBuffer.t) = "";
external pdf : pdfOptions => Js.Promise.t(Node.Buffer.t) = "";

/* TODO:
external on
@@ -9,18 +9,11 @@ type tracingOptions = {

[@bs.obj]
external makeTracingOptions :
(
~path: string,
~screenshots: bool=?,
~categories: array(string)=?,
unit
) =>
(~path: string, ~screenshots: bool=?, ~categories: array(string)=?, unit) =>
tracingOptions =
"";

[@bs.send.pipe: t]
external start : (~options: tracingOptions, unit) => Js.Promise.t(unit) =
"";
external start : (~options: tracingOptions, unit) => Js.Promise.t(unit) = "";

[@bs.send]
external stop : t => Js.Promise.t(Js.Typed_array.ArrayBuffer.t) = "";
[@bs.send] external stop : t => Js.Promise.t(Node.Buffer.t) = "";

0 comments on commit 5c7ae0d

Please sign in to comment.