Search code examples
phpjavascriptnode.jsv8magic-methods

Imitate PHP's __get(), __set() & __call() magic methods in Node.js


I was wondering if there is a way to imitate PHP's magic methods __get() and __set() in Node. From this question: JavaScript getter for all properties I know you can do it in Rhino, but Node's built on V8. Does V8 have some way of doing this?


Solution

  • No answer? Check out nowjs. They seem to have found a way to make __get() and __set() work in JavaScript. I can't figure out how they do it from the source code. :(

    EDIT: Check out Monitor All JavaScript Object Properties (magic getters and setters)