Skip to content

Instantly share code, notes, and snippets.

@sslotsky
Last active February 20, 2019 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sslotsky/cd14c612918974abbf3becf4bc4f0358 to your computer and use it in GitHub Desktop.
Save sslotsky/cd14c612918974abbf3becf4bc4f0358 to your computer and use it in GitHub Desktop.
[@bs.deriving abstract]
type context = {
mutable font: string,
mutable fillStyle: string,
};
[@bs.deriving abstract]
type measurement = {width: float};
[@bs.send]
external fillText : (context, string, float, float) => unit = "fillText";
[@bs.send]
external fillRect : (context, float, float, float, float) => unit = "fillRect";
[@bs.send]
external measureText : (context, string) => measurement = "measureText";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment