rx-handler
npm i rx-handler
Hello World
const myHandler = //logs "Hello"
Handle a Click
const button = document const onClick = button
With Operators
const $ = documentquerySelector const input = const button = const onInput = input const onClick = button
Angular Hello World
@ onClick = date$ =
Angular Multiple Handlers
Angular Multiple Handlers Demo
@ onInc = onDec = count$ = onInput = text$ = slicedText$ =
Description
Invoking handler
returns a function that can be observed. Thanks to RxJS v6, handler
also accepts operators just like .pipe()
.
const myHandler = //logs "Hello1"
Why?
Handlers are a core concept of JavaScript, but were impossible in RxJS until I got this PR accepted: Allow Functions in RxJS PR
Creating Subjects
to handle events for Angular templates (or any other frameworks) was a huge pain. It never felt quite right to pass a Subject
into an event handler an invoke next
to push values into a stream. I've always wanted to simply "pass a handler" to events, but still use streams.
rx-handler
enables you to pass handlers to events along with the bonus of accepting operators thanks to the new RxJS v6 architecture.
Nicholas Jamieson
Special Thanks toHe took my idea which used originally used Proxies and vastly improved it.