The sw&rpc server instance, which provides methods to register procedure implementations, and listens for incoming messages that call those procedures
A procedure declaration
A promise that you can cancel by calling .cancel(reason)
on it:
An implementation of a procedure
Declarations of procedures by name.
An example of declaring procedures:
Implementations of procedures by name
Declaration of hooks to run on messages received from the server
The effective payload as sent by the server to the client
A procedure's corresponding method on the client instance -- used to call the procedure. If you want to be able to cancel the request, you can use the cancelable
method instead of running the procedure directly.
Symbol used as the key for the procedures map on the server instance
Symbol used as the key for the procedures map on instances
A quicker version of postMessage that does not try to start the client listener, await the service worker, etc. esp. useful for abort logic that needs to not be... put behind everything else on the event loop.
Starts the client listener, which listens for messages from the sw&rpc server.
Generate a random request ID, used to identify requests between client and server.
Creates a sw&rpc server instance.
The sw&rpc client instance, which provides methods to call procedures. Each property of the procedures map will be a method, that accepts an input, an optional onProgress callback and an optional request ID. If you want to be able to cancel the request, you can set the request's ID yourself, and call
.abort(requestId, reason)
on the client instance to cancel it.