MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / register

Method register

crates/opencode-plugin/src/lib.rs:180–185  ·  view source on GitHub ↗
(&self, hook: Hook)

Source from the content-addressed store, hash-verified

178 }
179
180 pub async fn register(&self, hook: Hook) {
181 let mut hooks = self.hooks.write().await;
182 let entry = hooks.entry(hook.event.clone()).or_insert_with(Vec::new);
183 entry.push(Arc::new(hook));
184 entry.sort_by(|a, b| b.priority.cmp(&a.priority));
185 }
186
187 pub async fn trigger(&self, context: HookContext) -> Vec<HookResult> {
188 let hooks = self.hooks.read().await;

Callers 3

register_client_hooksMethod · 0.45

Calls 2

newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected