Browse topics
RobinPath Overview
On this page
Hooks
Three primitives for applet-to-applet communication: actions, filters, and calls.
Hooks
Hooks let applets communicate with each other safely. Three primitives:
| Primitive | Use when | Pattern |
|---|---|---|
| Actions | Broadcasting events | Fire-and-forget, multiple listeners |
| Filters | Transforming data through handlers | Priority chain, each handler mutates |
| Calls | Typed request/response operations | One handler, one reply |
Most applets use a mix. Use actions for notifications (“weather data updated”), filters for transforms (“format this temperature”), and calls for structured operations (“open this doc in the editor, return the opened path”).
Which one to pick?
-
Does the caller need a reply?
- Yes, and the semantics are “invoke this specific operation”: calls.
- Yes, and the semantics are “pipe this value through everything listening”: filters.
- No: actions.
-
Is there exactly one sensible handler (e.g., “get the currently opened file”)?
- Yes: calls.
-
Can there be many listeners that all want to know about an event?
- Yes: actions.
Capabilities
| Capability | Grants |
|---|---|
hooks:provide | Register action listeners, filter handlers, or call-hook handlers |
hooks:consume | Fire actions, apply filters, invoke calls |
Most applets that use hooks need both.