[Refactor] Reorganize config hooks into config_page_setter folder.

This commit is contained in:
Sakamoto Shiina committed 2025-11-05 15:15:09 +09:00
1 parent db820375f1
commit 5cbd7618e3
8 files changed
+11 -28

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { store } from "@store";
import { encode } from "js-base64";
export const useStdoutToPython = () => {
const asyncStdoutToPython = async (path, value = undefined) => {
let send_object = { endpoint: path };
if (value !== undefined) send_object.data = encode(JSON.stringify(value));
// send to python
const backend_subprocess = store.backend_subprocess;
if (backend_subprocess) {
await backend_subprocess.write(JSON.stringify(send_object) + "\n").then(() => {
}).catch((err) => {
console.log(err);
});
} else {
console.error("Backend subprocess is not found.", backend_subprocess);
}
};
return { asyncStdoutToPython };
};