firefly-compiler 0.5.41 → 0.5.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.41",
7
+ "version": "0.5.42",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.41",
7
+ "version": "0.5.42",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -10,14 +10,14 @@ open(browserSystem: BrowserSystem, url: String): WebSocket {
10
10
  !Js->location->href.isNullOrUndefined() && Js->location->href->startsWith("http")?
11
11
  ) {
12
12
  let href: String = Js->URL->(url, Js->location->href)->href?
13
- Js->WebSocket-> ("ws" + href.dropFirst("http".size()))
13
+ // Using globalThis here to avoid colliding with the Firefly WebSocket data constructor
14
+ Js.globalThis()->WebSocket->("ws" + href.dropFirst("http".size()))
14
15
  } else {
15
- Js->WebSocket->(url)
16
+ Js.globalThis()->WebSocket->(url)
16
17
  }
17
18
  socket->binaryType = "arraybuffer"
18
19
  let result = WebSocket(socket, Queue.new(), Queue.new())
19
20
  Js.awaitCancellablePromise {resolve, reject, onSettle =>
20
- onSettle {_ => socket->close()}
21
21
  socket->onopen = Js->{resolve(result)}
22
22
  socket->onclose = Js->{reject(_?)}
23
23
  }