We could add an IDL attribute with a name like NativeAccess. Then you'd
write

  [NativeAccess] attribute long someProperty;

- Alon


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

> Thanks Alon,
>
> This seems to be difference between WebIDL and Embind, as with Embind if
> you provide the getter/setter for the attribute then it uses the JS get set
> properties.  The one concern I was having with WebIDL, since these JS
> getter/setter are automatically generated it is not part of the defined c++
> interface, which means the generated interface doesn't match the original.
>
> Is there a way to state a getter/setter for an attribute using the WebIDL
> interface structure, I am not 100% sure on how that syntax should look (I
> cant seem to find a decent example of that).  But if that is possible, then
> modifing the code generate seems like a reasonable approach.
>
> On Thursday, December 4, 2014 8:40:48 PM UTC-6, Alon Zakai wrote:
>>
>> 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.
>

-- 
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