Marcisbee / radi

🌀Tiny (in size) front-end framework with no extra browser re-flows
https://radi.js.org
MIT License
948 stars 34 forks source link

Adds multiple subscribe event handling #42

Closed Marcisbee closed 6 years ago

Marcisbee commented 6 years ago

Description

Now can subscribe to multiple events with one subscription and transformer.

Example usage

const Pressed = new Subscribe()
  .on('mousedown mouseup', (e, name) => name === 'mousedown')

const Mouse = new Store({
  pressed: Pressed(false),
})

Mouse store will listen to mousedown and mouseup for pressed field.

When mouse is pressed output would be {pressed: true}; When released, it would be {pressed: false}.