-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
I haven't seen this discussed recently, but the ES6 Proxy object could (as I understand it) greatly simplify Vue's data binding code. Currently, it's supported in the current version of every major browser except current Safari/iOS (and that should be getting updated in a matter of weeks with WWDC right around the corner, and the Safari Tech Preview supports Proxy).
http://caniuse.com/#feat=proxy
The big benefits, as I see them are:
- Simpler (internal) binding code
- Ability to detect new properties (
Vue.set
would no longer be needed.) - No modifications to the original object need to be made
Because it's not quite universal, I propose making it an optional configuration on the VM instance for now. As I do a lot of game work with Electron and Vue, the ability to detect new properties would simplify some of my code quite a bit, and with Electron, what features the client has are always known, so I don't have to worry about different browser support.
I suspect that given browser usage these days, while Proxy support couldn't be the default for a while, it certainly could be used by a majority of users. It would even be possible to make it the default, and fall back to getter/setters if Proxy isn't supported. (There issues with that, I'm aware, as the developer might have relied on new property detection.)
Regardless, I feel having the feature would both send a message about where Vue is heading in the future and be useful to those people who can accept breaking on older browsers.