chore: enhance wip
This commit is contained in:
parent
bcdae1169e
commit
0f5923a10a
@ -6,6 +6,9 @@ import ReactDOM from "react-dom";
|
||||
import { RecoilRoot } from "recoil";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import Layout from "./pages/_layout";
|
||||
import setup from "./services/enhance";
|
||||
|
||||
setup();
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
|
22
src/services/enhance.ts
Normal file
22
src/services/enhance.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { emit, listen } from "@tauri-apps/api/event";
|
||||
import { CmdType } from "./types";
|
||||
|
||||
export default function setup() {
|
||||
listen("script-handler", (event) => {
|
||||
const payload = event.payload as CmdType.EnhancedPayload;
|
||||
console.log(payload);
|
||||
|
||||
// setTimeout(() => {
|
||||
// try {
|
||||
// const fn = eval(payload.script + "\n\nmixin");
|
||||
// console.log(fn);
|
||||
|
||||
// const result = fn(payload.params || {});
|
||||
// console.log("result", result);
|
||||
// emit(payload.callback, JSON.stringify(result)).catch(console.error);
|
||||
// } catch (err) {
|
||||
// console.error(err);
|
||||
// }
|
||||
// }, 3000);
|
||||
});
|
||||
}
|
@ -121,4 +121,15 @@ export namespace CmdType {
|
||||
enable_proxy_guard?: boolean;
|
||||
system_proxy_bypass?: string;
|
||||
}
|
||||
|
||||
export interface ChainItem {
|
||||
item: ProfileItem;
|
||||
merge?: object;
|
||||
script?: string;
|
||||
}
|
||||
|
||||
export interface EnhancedPayload {
|
||||
chain: ChainItem[];
|
||||
current: object;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user