handle(_:_:)¶
Answers JS’s ref.hook("<key>", method, args): handler gets the arguments, which cross as JSON, and a
HookReply, which it calls with the reply or fails, then or later.
func handle(_ method: String, _ handler: @escaping (_ args: [Any], _ reply: HookReply) -> Void)
Discussion¶
One handler per method: the last one wins. A handler that never replies leaves the call waiting until the view unmounts: a navigation or a crash doesn’t settle it.