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