Skip to main content
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
82%
Published
a month ago (2.0.0)

Event Broker Nextjs Hook

NextJS hook for using event broker

useAsyncEventBroker

Custom hook to manage AsyncEventBroker lifecycle

Automatically close the broker on component unmount


  const brokerProxy = useAsyncEventBroker( new AsyncEventBroker<ListenEvent,ReplyEvent>() );

  ...
  
  brokerProxy.on( async ( event: ListenEvent ) => { 
    ...
  })

Automatically start on component mount and close on unmount


  const brokerProxy = useAsyncEventBroker( new AsyncEventBroker<ListenEvent,ReplyEvent>(), async ( event: ListenEvent ) => { 
    ...
  } );

useEventBroker

Custom hook to manage EventBroker lifecycle

Automatically close the broker on component unmount


  const brokerProxy = useEventBroker( new EventBroker<ListenEvent,ReplyEvent>() );

  ...
  
  brokerProxy.on( ( event: ListenEvent ) => { 
    ...
  })

Automatically start on component mount and close on unmount


  const brokerProxy = useEventBroker( new EventBroker<ListenEvent,ReplyEvent>(), ( event: ListenEvent ) => { 
    ...
  } );

Add Package

deno add @soulsoftware/event-broker-react

Import symbol

import * as mod from "@soulsoftware/event-broker-react/";

Add Package

npx jsr add @soulsoftware/event-broker-react

Import symbol

import * as mod from "@soulsoftware/event-broker-react/";

Add Package

yarn dlx jsr add @soulsoftware/event-broker-react

Import symbol

import * as mod from "@soulsoftware/event-broker-react/";

Add Package

pnpm dlx jsr add @soulsoftware/event-broker-react

Import symbol

import * as mod from "@soulsoftware/event-broker-react/";

Add Package

bunx jsr add @soulsoftware/event-broker-react

Import symbol

import * as mod from "@soulsoftware/event-broker-react/";