Skip to content

Instantly share code, notes, and snippets.

@mattmarcello
Created January 18, 2018 21:22
Show Gist options
  • Save mattmarcello/31aa2ff4010c5cad497f35ba655a1042 to your computer and use it in GitHub Desktop.
Save mattmarcello/31aa2ff4010c5cad497f35ba655a1042 to your computer and use it in GitHub Desktop.
[@bs.send] external dispatchEvent : (Dom.window, Dom.event) => unit = "";
[@bs.new] external makeEvent : ([@bs.string] [ | `popstate]) => Dom.event = "Event";
let initializeRouter = () =>
switch ([%external window]) {
| None => ()
| Some(window: Dom.window) => dispatchEvent(window, makeEvent(`popstate));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment