INNER CODE UNIT · JavaScript

runActiveHooks

Sisyphe42/ReignsAgent · packages/core/src/index.js:518

function runActiveHooks(name, state, event) {
  for (const hookEntry of [...state.activeHooks]) {
    runHookEntry(hookEntry, name, state, event);
  }
}

function runHookEntry(hookEntry, name, state, event = {}) {
  const hook = hookEntry.hooks?.[name];
  if (!hook) {
    return;
  }

  hook(createHookContext(state, hookEntry, event));
}

function createHookContext(state, hookEntry, event) {
  return {
    state,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…