update: 'notify' method in jsonrpc2 client

This commit is contained in:
2026-06-25 10:23:41 +08:00
parent 1b9aff9676
commit f2628d0a2d
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "common" name = "common"
description = "Commonly reusable code" description = "Commonly reusable code"
version = "0.1.16" version = "0.1.17"
requires-python = ">=3.13" requires-python = ">=3.13"
authors = [ authors = [
{ name="BreakerBear", email="breakerbear@autistic.men" }, { name="BreakerBear", email="breakerbear@autistic.men" },
+3 -1
View File
@@ -24,7 +24,9 @@ export const Rpc2 = {
let request = { method }; let request = { method };
if (args.length > 0) request.params = args; if (args.length > 0) request.params = args;
let body = JSON.stringify(request); let body = JSON.stringify(request);
return navigator.sendBeacon('/', body); if (!navigator.sendBeacon('/', body)) {
throw new Error('Data transmission failed');
}
}, },
invoke: async (method, ...args) => { invoke: async (method, ...args) => {
let id = Math.floor(Math.random() * 1000000000); let id = Math.floor(Math.random() * 1000000000);