44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import { _ } from "./stear/main.js";
|
|
import { fadein, fadeout, wait } from "./stear/utils.js";
|
|
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"},[
|
|
_(), _(), _()
|
|
])
|
|
])
|
|
]);
|
|
|
|
export const call = async (stear,{find,resolve,render},{id,name}) => {
|
|
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);
|
|
}
|
|
}
|