Wednesday, May 24, 2017

Re: JsInterop and Function.prototype.apply 'this' argument

Hi,

I also had this problem. Seems that it was not possible back then (October 2016). I don't believe it is possible now.

Here is my jsni workaround in case you find something useful

https://groups.google.com/forum/#!topic/google-web-toolkit/Holpz8_ERD8

    Vassilis

On Wed, May 24, 2017 at 10:57 AM, Daniel Kaneider <kaneiderdaniel@gmail.com> wrote:
Hi,

as you probably know, in plain JS methods like apply or call allow you to pass any object for "this". Now, some JS libraries provide methods where you can pass some callback function, which is performed after some operation has finished. Some libraries choose to pass some special object for "this" which is not contained in the argument list. It is always documented how this object will look like, which means it can be mapped to some JsType.

But in the JsInterop world, is there a way that a @JsFunction can access "this" objects. I didn't find any suitable annotation for that. Is this even possible with JsInterop, or is it considered bad practice?
I actually managed to workaround it, using some JSNI code, but we know, this is not the future..


Thx in advance

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment