rx.onValue(v=> { // Get notified when proxy is changed });
// Get and set properties as usual console.log(proxy.x); proxy.x = 20; // Triggers Reactive
Keep in mind that changing target directly won't affect the proxied object or Reactive. Thus,
only update the proxied object after calling fromProxy.
The benefit of objectProxy instead of Rx.From.object is because the proxied object can be passed to other code that doesn't need
to know anything about Reactive objects.
You can assign the return values to more meaningful names using
JS syntax.
Creates a proxy of
target
, so that regular property setting will be intercepted and output on a Reactive object as well.Keep in mind that changing
target
directly won't affect the proxied object or Reactive. Thus, only update the proxied object after callingfromProxy
.The benefit of
objectProxy
instead of Rx.From.object is because the proxied object can be passed to other code that doesn't need to know anything about Reactive objects.You can assign the return values to more meaningful names using JS syntax.
See also:
rx
under a symbol on the proxy.