Extension Bus

Universal message bus for web extensions

Overview

Extension Bus provides cross-process messaging with an intuitive, API-like interface.

Create a bus in one process:

const bus = createBus({
  say: {
    hello (payload) {
      return `hello ${payload}!`
    }
  }
})
TypeScript

Call it from another process:

const bus = createBus({ ... })
const result = await bus.call('say/hello', 'world')
TypeScript

Key Features

This package provides an elegant solution, with:

  • simple cross-process messaging
  • named buses to easily target processes
  • nested handlers with an API-like interface
  • transparent handling of sync and async handlers
  • transparent handling of process and handler errors
  • transparent handling of internal and external calls
  • a consistent interface for process, tab and external calls

So...

I hope you found this post interesting or useful.

If you want to engage further, follow me on Twitter, Bluesky, or drop a comment or reaction below.

Either way, thanks for reading!