Skip to content

Introduction

Most event systems tie you to a framework’s own bus, or force every listener to match a raw (event, data) pair by hand. beepr separates two things:

  • the event vocabulary: request, success, error, data, complete, connected, disconnected;
  • the adapter: a typed object (onRequest, onSuccess, onError…) that createNotify turns into a raw handler.

On top of that, beepr adds two safety nets:

  • redaction: payloads are masked before adapters see them;
  • debug gating: debug output only runs in environments you allow.

beepr is not published to npm yet. Install it from GitHub:

Terminal window
pnpm add github:techmefr/beepr
Terminal window
import { createNotify } from 'beepr'
const notify = createNotify({
onRequest: context => console.log('request', context.resource),
onSuccess: data => console.log('success', data),
onError: error => console.error('error', error.message),
})
notify('request', { resource: 'users', payload: { id: 1 } })
notify('success', { id: 1, name: 'Alice' })