The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

386255 (2) [Avatar] Offline
First off, thanks for all your hard work on this book. It's a very interesting topic and I'm enjoying exploring it.

I'm in chapter 7 and you are using Object.observe to react to changes in the model within each plugin. However, this API has been deprecated and its not in the latest version of node.

You may be able to implement similar functionality with the ES6 Proxy feature.
domguinard (71) [Avatar] Offline

First: thanks a lot for the compliment, we are glad you enjoy the book!
Then in terms of Object.observe() we knew it was potentially going to be removed (there is a note in the book about that) from future versions.

The current LTS (version 4.X, supported until 2018-04-01) will keep supporting observe() but as you rightfully flagged the 6.X does not support it, which means the next LTS will not support it.
The problem with changing this is that the code relies on observe() quite a bit so we might not be able to change this before the book goes to print. Nevertheless we are now looking into a solution (such as the Proxy you suggested) and will upgrade the code accordingly on Git and keep you posted!
386255 (2) [Avatar] Offline
Cool good to know. It's a shame they didn't keep Object.observe around because its very convenient and simple to use.
Vlad Trifa (16) [Avatar] Offline
Hello, thanks for the feedback - this is the thing when you use node.js, by the time you wrote your app you can rewrite it given how quickly it changed (and we had to change quite a few things like this while writing the book just because how quickly node evolved).
431450 (10) [Avatar] Offline
I try to change 7.12 Listing code into this but it seem not working.
exports.start = function () {
var objectToObserve = new Proxy(model, objectChangeHandler)

var objectChangeHandler = {
get: function (target, prop) {
return Reflect.get(target, prop);
set: function (target, prop, value) {'Change detected by plugin for %s...', pluginName);
return Reflect.set(target, prop, value);

I has removed all simulation code because I have raspberry pi. I hope that you can help me improve this code. Thanks
431450 (10) [Avatar] Offline
I resolved this by using WatchJS.

Very useful library, I hope this can help someone like me.
domguinard (71) [Avatar] Offline
Thanks for your post, watch.js is indeed one option thanks for that, we are now looking into this issue actively as the new Node LTS is 6 and it does not support observe(). Stay tuned on Git for progress: