update: 'notify' method in jsonrpc2 client
This commit is contained in:
+1
-1
@@ -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" },
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user