Command contributions to a composite tool.
An addon contributes named subcommands to a host tool, so
analysis command="lint ..." reaches the contributing addon's handler.
Each contribution records the contributing addon so shutdown can retract
everything that addon added.
Shape: {tool-name {command-name {:handler fn :params {} :description str :addon addon-id}}}
Command contributions to a composite tool.
An addon contributes named subcommands to a host tool, so
`analysis command="lint ..."` reaches the contributing addon's handler.
Each contribution records the contributing addon so shutdown can retract
everything that addon added.
Shape: {tool-name {command-name {:handler fn :params {} :description str
:addon addon-id}}}(add-listener! listener-id f)Register f, called with a contribution event after every mutation here.
This seam exists because the STORE alone is not the whole concept. A host advertises a tool surface built from these contributions, and a contribution that arrives AFTER that surface was built has to tell it so. While only the host had listeners, an addon that migrated to this registry kept working at boot (the surface is assembled later anyway) and silently failed for any post-boot contribution, which is the worst shape of failure: correct on the path everyone tests, wrong on the path nobody does.
Idempotent by id: re-registering an id replaces its fn rather than stacking.
f MUST NOT THROW. This namespace is in the portable three-host stratum and
carries no reader conditionals, so it cannot catch a platform exception class
on the caller's behalf. A listener that can fail wraps itself; a JVM host
registers an already-guarded fn. A throwing listener will propagate out of
the contribute!/retract! that triggered it.
Register `f`, called with a contribution event after every mutation here. This seam exists because the STORE alone is not the whole concept. A host advertises a tool surface built from these contributions, and a contribution that arrives AFTER that surface was built has to tell it so. While only the host had listeners, an addon that migrated to this registry kept working at boot (the surface is assembled later anyway) and silently failed for any post-boot contribution, which is the worst shape of failure: correct on the path everyone tests, wrong on the path nobody does. Idempotent by id: re-registering an id replaces its fn rather than stacking. `f` MUST NOT THROW. This namespace is in the portable three-host stratum and carries no reader conditionals, so it cannot catch a platform exception class on the caller's behalf. A listener that can fail wraps itself; a JVM host registers an already-guarded fn. A throwing listener will propagate out of the contribute!/retract! that triggered it.
(clear!)Remove every contribution. Returns nil.
Remove every contribution. Returns nil.
(contribute! tool-name addon-id commands)Merge COMMANDS into TOOL-NAME's command tree on behalf of ADDON-ID. Notifies listeners afterwards. Returns the contributed command names.
Merge COMMANDS into TOOL-NAME's command tree on behalf of ADDON-ID. Notifies listeners afterwards. Returns the contributed command names.
(contributed-tool-names)Every tool name carrying contributions.
Every tool name carrying contributions.
(get-commands tool-name)The contributed command tree for TOOL-NAME, or nil.
The contributed command tree for TOOL-NAME, or nil.
(listener-ids)Every registered listener id.
Every registered listener id.
(remove-listener! listener-id)Drop a listener. Returns the id. Safe when absent.
Drop a listener. Returns the id. Safe when absent.
(retract! tool-name addon-id)Remove every command ADDON-ID contributed to TOOL-NAME. Notifies listeners afterwards. Returns nil.
Remove every command ADDON-ID contributed to TOOL-NAME. Notifies listeners afterwards. Returns nil.
(retract-all! addon-id)Remove every command ADDON-ID contributed to any tool. Notifies listeners once per tool the addon had actually touched. Returns nil.
The touched set is read BEFORE the retraction, or there is nothing left to attribute the notifications to.
Remove every command ADDON-ID contributed to any tool. Notifies listeners once per tool the addon had actually touched. Returns nil. The touched set is read BEFORE the retraction, or there is nothing left to attribute the notifications to.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |