Toast Notifications

Global event bus with o.createStore — call notify.push() from anywhere, no Provider, no hook, no component import.

Architecture

notifyStore = o.createStore({ queue: [] })

  notifyStore.subscribe(toastContainer, 'sync')  → adds / removes toast DOM nodes

notify.push({ type, message }) → queue → notify()
Auto-dismiss: setTimeout removes item → notify() again.
Call from anywhere — no Provider, no hook, no component import.

Why Objs

React

// Needs Context wrapping the app
<ToastProvider>
  <App />
</ToastProvider>

// useState in root
const [toasts, setToasts] = useState([]);

// useEffect per timer with cleanup
useEffect(() => {
  const id = setTimeout(() => {
    setToasts(t => t.filter(...));
  }, 3000);
  return () => clearTimeout(id);
}, [toasts]);

// useContext in every file that fires
const { push } = useContext(ToastContext);
push({ type: 'success', message: 'Saved!' });

Objs

// Call from any file — that's it:
notify.push({
  type: 'success',
  message: 'Saved!'
});

objs-core on npm