3 ms·
Can observables be implemented efficiency without VM support? I can't think of a good way to do it without constant deep comparisons -- effectively "busy waitin
by api 11y ago
Can observables be implemented efficiency without VM support? I can't think of a good way to do it without constant deep comparisons -- effectively "busy waiting" on changes.
- WorldMaker 11y agoSeveral of the libraries out there (including maybe the polymer "polyfill" for Object.observe, observe-js, although I haven't actually checked) use the ES5 tool Object.defineProperty to convert the members on an object to have observable semantics. There is also the new ES6/ES2015 Proxy class that can be used effectively and efficiently for the sort of meta-programming of wiring up an entire object for observation. That said, there's also the tried and true methods of doing things "manually" a property at a time. Knockout and its observable functions remains rather efficient with a very long tail of older browser support.