From f2628d0a2d79747e6737365b68823530f8ec01e2 Mon Sep 17 00:00:00 2001 From: break27 Date: Thu, 25 Jun 2026 10:23:41 +0800 Subject: [PATCH] update: 'notify' method in jsonrpc2 client --- pyproject.toml | 2 +- src/common/jsonrpc2/client.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2011f25..c2c30da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "common" description = "Commonly reusable code" -version = "0.1.16" +version = "0.1.17" requires-python = ">=3.13" authors = [ { name="BreakerBear", email="breakerbear@autistic.men" }, diff --git a/src/common/jsonrpc2/client.js b/src/common/jsonrpc2/client.js index 2777a06..ae33853 100644 --- a/src/common/jsonrpc2/client.js +++ b/src/common/jsonrpc2/client.js @@ -24,7 +24,9 @@ export const Rpc2 = { let request = { method }; if (args.length > 0) request.params = args; let body = JSON.stringify(request); - return navigator.sendBeacon('/', body); + if (!navigator.sendBeacon('/', body)) { + throw new Error('Data transmission failed'); + } }, invoke: async (method, ...args) => { let id = Math.floor(Math.random() * 1000000000);