2022-06-09 16:26:27 +02:00
|
|
|
import { _ } from "../stear/main.js";
|
|
|
|
import { fadein, fadeout, wait } from "../stear/utils.js";
|
2022-06-09 15:29:53 +02:00
|
|
|
import "./waitStyle.js";
|
|
|
|
|
|
|
|
export const preRender = true;
|
|
|
|
|
|
|
|
export const render = ({},{}) =>
|
|
|
|
_({find:"main"},[
|
|
|
|
_({type:"p",find:"text",style:{
|
|
|
|
position: "absolute",
|
|
|
|
minWidth: "90%",
|
|
|
|
textAlign: "center",
|
|
|
|
top: "25%",
|
|
|
|
left: "50%",
|
|
|
|
transform: "translate(-50%,-50%)",
|
|
|
|
}}),
|
|
|
|
_({style:{
|
|
|
|
position: "absolute",
|
|
|
|
left: "50%",
|
|
|
|
top: "50%",
|
|
|
|
transform: "translate(-50%, -50%)",
|
|
|
|
}},[
|
|
|
|
_({class:"box"},[
|
|
|
|
_(), _(), _()
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
2022-06-09 16:26:27 +02:00
|
|
|
export const call = async (stear, { find, resolve, render, call }, {name,id}) => {
|
2022-06-09 15:29:53 +02:00
|
|
|
find.text._.innerText = "Connecting to: " + name + " (" + id + ")";
|
|
|
|
await fadein(find.main._, 200, true);
|
|
|
|
//do connection
|
|
|
|
await wait(1000);
|
|
|
|
var success = Math.random()>0.25;
|
|
|
|
if(success){
|
|
|
|
alert("success");
|
|
|
|
await fadeout(find.main._);
|
|
|
|
return resolve(true);
|
|
|
|
}else{
|
|
|
|
alert("error");
|
|
|
|
await fadeout(find.main._);
|
|
|
|
return resolve(false);
|
|
|
|
}
|
|
|
|
}
|