Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

549 B
Raw Blame
import { type Accessor, createSignal } from 'solid-js';

export type FocusRequest = {
  pending: Accessor<number | undefined>;
  request: () => void;
  consume: () => boolean;
};

export function createFocusRequest(): FocusRequest {
  const [pending, setPending] = createSignal<number | undefined>();
  let nextId = 0;

  return {
    pending,
    request: () => {
      nextId += 1;
      setPending(nextId);
    },
    consume: () => {
      if (pending() === undefined) return false;
      setPending(undefined);
      return true;
    },
  };
}