-
-
Notifications
You must be signed in to change notification settings - Fork 212
Closed
Labels
Description
description
Thank @webfansplz for the original version in #195. I mimic the codes in the #212.
After the #212 has been approved, two events will depend on Vite RPC. They are designed to trigger changes reactively in the client.
However, I think some problems need to be improved.
problems
- The default value of the function is an anonymous function everywhere. Maybe a
const NOOP = () => {}
is more appropriate. - The same RPC function name and type between
server-to-client
andclient-to-server
. What about designing a rule to define RPC function names clearly? It will make anyone who uses the RPC functions more easily comprehend. - Manually copied codes will be fragile. What about designing an
RPC function factory
to easily create an RPC function with safe types and better-designed names?
new feature
Adding a return callback to remove the client-designed callback itself since the client-designed callbacks will be tracked in an array and the off
will remove all callbacks by setting the length of the array to zero.