0.1.2 • Published 5 years ago
@replygirl/proxied-behavior-subject v0.1.2
ProxiedBehaviorSubject
A BehaviorSubject that returns a Proxy. All the reactivity, without having to call next!
Note: I literally haven't tested this
Installation
yarn add @replygirl/proxied-behavior-subjectUsage
import ProxiedBehaviorSubject from '@replygirl/proxied-behavior-subject'
const foo = new ProxiedBehaviorSubject({
bar: true
})
const f = foo.proxy
console.info(f.bar, foo.value.bar) // true, true
foo.next({ bar: false })
console.info(f.bar, foo.value.bar) // false, false
f.bar = true
console.info(f.bar, foo.value.bar) // true, true