update: jsonrpc2 client 'notify'

This commit is contained in:
2026-06-04 14:54:00 +08:00
parent 772a8eb368
commit 020576ff18
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "common"
description = "Commonly reusable code"
version = "0.1.15"
version = "0.1.16"
requires-python = ">=3.13"
authors = [
{ name="BreakerBear", email="breakerbear@autistic.men" },
+1 -1
View File
@@ -24,7 +24,7 @@ export const Rpc2 = {
let request = { method };
if (args.length > 0) request.params = args;
let body = JSON.stringify(request);
await fetch('/', { method: 'POST', body });
return navigator.sendBeacon('/', body);
},
invoke: async (method, ...args) => {
let id = Math.floor(Math.random() * 1000000000);
+1 -1
View File
@@ -170,7 +170,7 @@ class ServiceProvider:
opts = cls.Options()
self = cls(opts)
self.set('history', lambda: history.truncate())
self.set('exit', lambda: t.interrupt_main() or sys.exit(0))
self.set('exit', lambda: (t.interrupt_main(), sys.exit(0)))
return self
@dataclasses.dataclass