@@ -60,7 +60,7 @@ let arrayToList = a => {
6060/* actually you know what, not gonna provide search for now. It's a mess.
6161 We'll let users roll their own solution/data structure for now */
6262let path = () =>
63- switch %external (window ) {
63+ switch %global (window ) {
6464 | None => list {}
6565 | Some (window : Dom .window ) =>
6666 switch window |> location |> pathname {
@@ -78,7 +78,7 @@ let path = () =>
7878 }
7979 }
8080let hash = () =>
81- switch %external (window ) {
81+ switch %global (window ) {
8282 | None => ""
8383 | Some (window : Dom .window ) =>
8484 switch window |> location |> hash {
@@ -91,7 +91,7 @@ let hash = () =>
9191 }
9292 }
9393let search = () =>
94- switch %external (window ) {
94+ switch %global (window ) {
9595 | None => ""
9696 | Some (window : Dom .window ) =>
9797 switch window |> location |> search {
@@ -103,15 +103,15 @@ let search = () =>
103103 }
104104 }
105105let push = path =>
106- switch (%external (history ), %external (window )) {
106+ switch (%global (history ), %global (window )) {
107107 | (None , _ )
108108 | (_ , None ) => ()
109109 | (Some (history : Dom .history ), Some (window : Dom .window )) =>
110110 pushState (history , ~href = path )
111111 dispatchEvent (window , safeMakeEvent ("popstate" ))
112112 }
113113let replace = path =>
114- switch (%external (history ), %external (window )) {
114+ switch (%global (history ), %global (window )) {
115115 | (None , _ )
116116 | (_ , None ) => ()
117117 | (Some (history : Dom .history ), Some (window : Dom .window )) =>
@@ -143,15 +143,15 @@ let url = () => {path: path(), hash: hash(), search: search()}
143143/* alias exposed publicly */
144144let dangerouslyGetInitialUrl = url
145145let watchUrl = callback =>
146- switch %external (window ) {
146+ switch %global (window ) {
147147 | None => () => ()
148148 | Some (window : Dom .window ) =>
149149 let watcherID = () => callback (url ())
150150 addEventListener (window , "popstate" , watcherID )
151151 watcherID
152152 }
153153let unwatchUrl = watcherID =>
154- switch %external (window ) {
154+ switch %global (window ) {
155155 | None => ()
156156 | Some (window : Dom .window ) => removeEventListener (window , "popstate" , watcherID )
157157 }
0 commit comments