This commit is contained in:
Rizky 2024-07-15 19:08:31 +07:00
parent 2db41f543b
commit 8a8288f00a
2 changed files with 4 additions and 23 deletions

View File

@ -155,13 +155,6 @@ export const viEvalProps = (
val = (...args: any[]) => {
return meta.item.script?.props?.[name].fn(...args);
};
// val = new Function(
// `// [${meta.item.name}] ${name}: ${meta.item.id}
// const { ${Object.keys(arg).join(", ")} } = this;
// const fn = ${val.toString()}
// return fn(...arguments);
// `
// ).bind(arg);
}
arg[name] = val;

View File

@ -165,9 +165,10 @@ const connect = (
`${url.protocol}//${url.host}${url.pathname}`
);
const timeout = setTimeout(() => {
let timeout = setTimeout(() => {
clearTimeout(timeout);
ws.close();
retry();
retry();
}, 2000);
ws.onopen = () => {
@ -179,20 +180,7 @@ const connect = (
conf.ws = ws;
event.opened();
};
ws.onclose = async () => {
w.offline = true;
w.editorRender?.();
const res = event.disconnected();
if (res.reconnect) {
setTimeout(async () => {
reconnect++;
retry();
}, reconnect * WS_CONFIG.reconnectTimeout);
} else {
reject();
}
};
ws.onmessage = async (e) => {
const raw = e.data as Blob;
const msg = packr.unpack(Buffer.from(await raw.arrayBuffer()));