Use ReconnectingWebSocket in the dev.js polyfill
This commit is contained in:
parent
96dd2d6a91
commit
2c66bdb72e
|
@ -24,7 +24,7 @@ final class Watcher {
|
|||
init(_ paths: [AbsolutePath]) throws {
|
||||
publisher = subject.eraseToAnyPublisher()
|
||||
|
||||
fsWatch = FSWatch(paths: paths) { [weak self] in
|
||||
fsWatch = FSWatch(paths: paths, latency: 0.1) { [weak self] in
|
||||
self?.subject.send($0)
|
||||
}
|
||||
try fsWatch.start()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { SwiftRuntime } from "javascript-kit-swift";
|
||||
import { WASI } from "@wasmer/wasi";
|
||||
import { WasmFs } from "@wasmer/wasmfs";
|
||||
import ReconnectingWebSocket from "reconnecting-websocket";
|
||||
|
||||
const swift = new SwiftRuntime();
|
||||
// Instantiate a new WASI Instance
|
||||
|
@ -14,13 +15,13 @@ const wasi = new WASI({
|
|||
},
|
||||
});
|
||||
|
||||
const socket = new WebSocket("ws://127.0.0.1:8080/watcher");
|
||||
const socket = new ReconnectingWebSocket("ws://127.0.0.1:8080/watcher");
|
||||
|
||||
socket.onmessage = (message) => {
|
||||
socket.addEventListener("message", (message) => {
|
||||
if (message.data === "reload") {
|
||||
location.reload();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
const startWasiTask = async () => {
|
||||
// Fetch our Wasm File
|
||||
|
|
|
@ -3033,6 +3033,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"reconnecting-websocket": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/reconnecting-websocket/-/reconnecting-websocket-4.4.0.tgz",
|
||||
"integrity": "sha512-D2E33ceRPga0NvTDhJmphEgJ7FUYF0v4lr1ki0csq06OdlxKfugGzN0dSkxM/NfqCxYELK4KcaTOUOjTV6Dcng=="
|
||||
},
|
||||
"regex-not": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
"@wasmer/wasi": "^0.10.2",
|
||||
"@wasmer/wasmfs": "^0.10.2",
|
||||
"javascript-kit-swift": "^0.3.0",
|
||||
"reconnecting-websocket": "^4.4.0",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue