You could modify the code generator to emit a JS setter and getter, but
there isn't an option for that currently. I've preferred to have function
calls to keep it clear that this is going to call into compiled code, as
opposed to doing a quick JS property lookup. But maybe that was the wrong
thing.

- Alon


On Thu, Dec 4, 2014 at 1:57 PM, Corey Clark <[email protected]> wrote:

> I am working on setting up a pipeline to do some testing between WebIDL
> and Embind with Emscripten.  I am having an issue getting direct access to
> attributes defined in c++ classes when compiled to javascript.
>
> For example, given this C++ class:
>
> class Bar {
> public:
>   Bar(float val);
>   void doSomething();
>   float myVal;
> };
>
> When compiled using the following WebIDL interface:
> interface Bar {
>         void Bar(float val);
>         void doSomething();
>         attribute float myVal;
> };
>
> The attribute myVal can not be directly accessed from the JS Module
> returned.
> For example:
>
> var b = new Module.Bar(33);
>
> b.myVal <-- does not work
>
> It instead auto generates a getter and setter with this format:
>
> b.get_myVal();
> b.set_myVal(num);
>
>
> Is there a way to manually define the getter/setter so that b.myVal would
> work?  Or just prevent the getter/setter from being created and have direct
> access to the attribute.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to