So, I was reading over the V8 docs yesterday and found a really neat feature in the C++ API… Interceptors.
Interceptors let you provide a global getter/setter on an object so you can get a callback for ANY property request/set without specially adding a setter/getter by name for it. This is something that I’ve found lacking in V8 JS Land to mimic PHP’s __get and __set methods, but it appears it does exists, just only on the C++ side!
So I wrote Magic this weekend, my first full 1.0.0 (1.0.1 actually, slight fix) release of a module to the public (advertised). This lets you play with a Magic Object with your own custom getters/setters (Interceptors) and do creative things with it.
Hopefully some modules that use promised based approaches will find creative ways to use these magic objects and create useful things out of it!
Download/Instructions @ GitHub
Leave a Reply
Log in to Reply