https://github.com/mschwartz/SilkJS-Harmony
Note that SilkJS turns on harmony extensions to make this all possible. If you are using some other JS implementation, you'll have to see if you need to start up with some extra command line switches or whatever. On Sep 27, 2012, at 6:37 PM, Christoph Martens <[email protected]> wrote: > Hey everyone, > > I wanted to ask if anyone of you knows a possibility to have the capability > of defining accessors of Objects inside the javascript side. > > Why am I asking? > > For my V8GL environment, I have the glut bindings in place. That means they > are available inside the javascript context via: > > glut.get(glut.WINDOW_WIDTH); > > Now I want to emulate the WebGL API on top of the usual GL/GLES/GLUT stuff. > But, for example, I want to offer the glut functionality wrapped with > JavaScript polyfills. I think that this is the best way to get there to not > having obsolete or duplicated code on the C++ side. > > For example, I wanted to do something like this: > > var Window = function(width, height) { > }; > > Window.__SETACCESSOR('x', function() { > glut.get(glut.WINDOW_X); > }); > > I know that on the native side, you can use setAccessor() on templates, but I > don't know if there's a possibility to offer the same functionality here on > the javascript side somehow via extending the native Object in JS or > something. > > Does anyone of you have a clue where to start or if that is possible? > > Thanks! > Christoph > > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
