Skip to content

Instantly share code, notes, and snippets.

@sgrove
Created December 8, 2016 17:20
Show Gist options
  • Save sgrove/707d55a3874045287c142732932597b9 to your computer and use it in GitHub Desktop.
Save sgrove/707d55a3874045287c142732932597b9 to your computer and use it in GitHub Desktop.
Example Reason+Bucklescript bindings
external log : 'anything => unit = "console.log" [@@bs.val];
external trace : 'anything => unit = "console.trace" [@@bs.val];
/*
* vim: set ft=rust:
* vim: set ft=reason:
*/
type element;
external getElementById : string => element = "document.getElementById" [@@bs.val];
external querySelector : string => element = "document.querySelector" [@@bs.val];
type intervalId;
type timeoutId;
external setInterval : (unit => unit) => int => intervalId = "window.setInterval" [@@bs.val];
external clearInterval : intervalId => unit = "window.clearInterval" [@@bs.val];
external setTimeout : (unit => unit) => int => timeoutId = "window.setTimeout" [@@bs.val];
external reload : unit => unit = "window.location.reload" [@@bs.val];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment