From 10c0fc0b169a600352eafd1c286fcf05ed8d460f Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 6 Jun 2026 23:44:57 +0800 Subject: [PATCH] :sparkles: https://github.com/siyuan-note/siyuan/pull/17487 Signed-off-by: Daniel <845765@qq.com> --- app/src/plugin/kernel.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/src/plugin/kernel.ts b/app/src/plugin/kernel.ts index c6c2cc2cf..87e2968e7 100644 --- a/app/src/plugin/kernel.ts +++ b/app/src/plugin/kernel.ts @@ -79,41 +79,39 @@ export class Kernel implements IKernelPlugin { } #createRpc(): IKernelPluginRpc { - const self = this; - const call = new Proxy({} as Record Promise>, { - get(_target, method: string) { - return (...args: TJsonRpcMethodParams) => self.#rpcCall(method, ...args); + get: (_target, method: string) => { + return (...args: TJsonRpcMethodParams) => this.#rpcCall(method, ...args); } }); const notify = new Proxy({} as Record void>, { - get(_target, method: string) { - return (...args: TJsonRpcMethodParams) => self.#rpcNotify(method, ...args); + get: (_target, method: string) => { + return (...args: TJsonRpcMethodParams) => this.#rpcNotify(method, ...args); } }); return { call, notify, - batch: self.#rpcBatchCall.bind(self), + batch: this.#rpcBatchCall.bind(this), bind: (method: TJsonRpcMethod, handler: TJsonRpcHandler) => { const handlers = (() => { - let handlers = self.#handlers.get(method); + let handlers = this.#handlers.get(method); if (!handlers) { handlers = new Set(); - self.#handlers.set(method, handlers); + this.#handlers.set(method, handlers); } return handlers; })(); handlers.add(handler); }, unbind: (method: TJsonRpcMethod, handler: TJsonRpcHandler) => { - const handlers = self.#handlers.get(method); + const handlers = this.#handlers.get(method); if (handlers) { handlers.delete(handler); if (handlers.size === 0) { - self.#handlers.delete(method); + this.#handlers.delete(method); } } },