fix
This commit is contained in:
parent
2db41f543b
commit
8a8288f00a
|
|
@ -155,13 +155,6 @@ export const viEvalProps = (
|
||||||
val = (...args: any[]) => {
|
val = (...args: any[]) => {
|
||||||
return meta.item.script?.props?.[name].fn(...args);
|
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;
|
arg[name] = val;
|
||||||
|
|
|
||||||
|
|
@ -165,9 +165,10 @@ const connect = (
|
||||||
`${url.protocol}//${url.host}${url.pathname}`
|
`${url.protocol}//${url.host}${url.pathname}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const timeout = setTimeout(() => {
|
let timeout = setTimeout(() => {
|
||||||
|
clearTimeout(timeout);
|
||||||
ws.close();
|
ws.close();
|
||||||
retry();
|
retry();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
|
|
@ -179,20 +180,7 @@ const connect = (
|
||||||
conf.ws = ws;
|
conf.ws = ws;
|
||||||
event.opened();
|
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) => {
|
ws.onmessage = async (e) => {
|
||||||
const raw = e.data as Blob;
|
const raw = e.data as Blob;
|
||||||
const msg = packr.unpack(Buffer.from(await raw.arrayBuffer()));
|
const msg = packr.unpack(Buffer.from(await raw.arrayBuffer()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue