update: jsonrpc2 client 'notify'
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.15"
|
||||
version = "0.1.16"
|
||||
requires-python = ">=3.13"
|
||||
authors = [
|
||||
{ name="BreakerBear", email="breakerbear@autistic.men" },
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user