DefineProperty, getters, and setters

So, what happens with the data once passed to the Vue instance? What are these transformations that Vue applies to it so that it becomes so automatically bound to the View layer?

Let's analyze what would we do if we had, let's say, a string, and every time it changes we would like to apply some transformations to some DOM element. How would we apply the string-changing listener function? To what would we attach it? There is no such thing as var stringVar='hello';stringVar.onChange(doSomething) .

So we would probably wrap the string's value setting and getting in some sort of function that would do something, for example, updating the DOM each time the string was updated. How would you implement it? While you're ...

Get Learning Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.