0.1.4 • Published 3 years ago

@21epub/rxjs-event-bus v0.1.4

Weekly downloads
48
License
MIT
Repository
github
Last release
3 years ago

@21epub/rxjs-event-bus

Made with create-storybook-react-library

NPM JavaScript Style Guide Build Status Codecov

Intro

This is a module for event management.

Feature

  • Easy-to-use
  • Typescript Support
  • Rxjs
  • Hooks support

Install

npm install --save @21epub/rxjs-event-bus

Usage

import RxBus from '@21epub/rxjs-event-bus'

// create instance
const rxBus = new RxBus()

// register events
rxBus.register<string>('event1')

// or register batch of events
rxBus.register<string>(['event1', 'event2'])

// subscribe to a event just like using rxjs subject
rxBus.subject('event1').subscribe((result) => console.log(result))

// tigger event
rxBus.subject('event1').next('ok')

// support Sync Event
rxBus.register('syncEvent', 'SyncSubject')
rxBus.syncSubject('syncEvent').subscribe((result) => console.log(result)) // something
rxBus.syncSubject('syncEvent').next('something')

Developing and running on localhost

First install dependencies and then install peerDeps for storybook dev:

npm install

To run Example in hot module reloading mode:

npm start   # or npm run storybook

To create a bundle library module build:

npm run build

Testing

To run unit tests:

npm test

License

MIT © 21epub

0.1.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago