mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-16 12:08:07 +01:00
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import {openMobileFileById} from "../editor";
|
|
import {processSync, progressLoading, progressStatus, transactionError} from "../../dialog/processSystem";
|
|
import {Constants} from "../../constants";
|
|
|
|
export const onMessage = (data: IWebSocketData) => {
|
|
if (data) {
|
|
switch (data.cmd) {
|
|
case"progress":
|
|
progressLoading(data);
|
|
break;
|
|
case"syncing":
|
|
processSync(data);
|
|
if (data.code !== 0) {
|
|
document.getElementById("transactionTip").classList.add("fn__none");
|
|
}
|
|
break;
|
|
case "create":
|
|
case "createdailynote":
|
|
openMobileFileById(data.data.id);
|
|
break;
|
|
case "openFileById":
|
|
openMobileFileById(data.data.id, [Constants.CB_GET_FOCUS]);
|
|
break;
|
|
case"txerr":
|
|
transactionError(data);
|
|
break;
|
|
case"statusbar":
|
|
progressStatus(data);
|
|
break;
|
|
}
|
|
}
|
|
};
|