You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { reactive, ref } from "vue";
|
|
|
|
|
|
|
|
export function connect(endpoint, callback){
|
|
|
|
const socket = new WebSocket(endpoint);
|
|
|
|
|
|
|
|
// Connection opened
|
|
|
|
socket.addEventListener("open", (event) => {
|
|
|
|
console.log("Connection open");
|
|
|
|
});
|
|
|
|
|
|
|
|
// Listen for messages
|
|
|
|
socket.addEventListener("message", callback);
|
|
|
|
|
|
|
|
window.onbeforeunload = function() {
|
|
|
|
socket.close();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export let autodartsState = reactive({
|
|
|
|
status: null
|
|
|
|
})
|