Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Colin Alworth
    @niloc132
    sorry, had to afk to make more coffee - i'm mostly saying that you should try to pretend for a moment that GWT doesnt exist, and just run your server, however it is that you might do that, and consider GWT dev mode to be just a tool to assist managing your JS (...sort of)
    Nicolas Chamouard
    @nchamouard
    hello
    is there somewhere a "official" list of all the types supported by JsInterop ?
    Colin Alworth
    @niloc132
    hmm. jsinterop is just the annotations and some util calls to map js typed to java types, but to my knowledge there isn't any JS type that can't be supported by jsinterop
    if a type isn't in elemental2, there are a few other places it might be, but nothing too exhaustive (the one other big library of types is akasha)
    Dmitrii Tikhomirov
    @treblereel
    yeap, i would say, it’s easier to define the list of java types we can’t use with JsInterop
    Colin Alworth
    @niloc132
    we don't have a way to say "throw", or "delete", but those aren't really types, but specific operations. it is hard to reference arguments and this in a way that does what JS would do natively
    Nicolas Chamouard
    @nchamouard
    i have read here https://github.com/intendia-oss/autorest/wiki/JsInterop-DTO-strategy that i can get Double from a @JsProperty but not Integer, it seemed strange to me
    Nicolas Chamouard
    @nchamouard
    my question was not very well formulated, i was referring to the javascript types we can directly transfer to java using @JsProperty
    Colin Alworth
    @niloc132
    js Number is a nullable 64-bit ieee754 floating point value (with some internal optimizations for handling ints with less precision than that), which maps just about perfectly to a java.lang.Double
    but naturally, not to a java.lang.Integer
    Nicolas Chamouard
    @nchamouard
    ok the reason why Double works but no Integer is quite clear thx
    my knowledge of JS is quite limited unfortunately, it seems i will need to dig a little deeper
    Colin Alworth
    @niloc132
    are you experiencing a specific issue that we can help with?
    Nicolas Chamouard
    @nchamouard
    no i was just wondering why certain types translates directly and not others, and was looking for some sort of "list"
    curiosity :)
    Colin Alworth
    @niloc132
    https://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html and https://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJsInterop.html dont cover this well enough - Double and Boolean didnt use to have this special case, but now they do
    Bob Lacatena
    @blacatena
    So, I made some progress... if I'm running in dev then Window.Location.getHost() yields 127.0.0.1:8888, in which case I hardcoded the path to the module with http://127.0.0.1:8888/. I could probably just do that all the time (i.e. construct a complete, not relative, path using Window.Location), but this is a little more clear in the code (if "dev" then the-hard-way else the-easy-way).
    But now I get error an error when it does import: TypeError: Cannot set property window of #<Window> which has only a getter at <... script:line:character here>.
    Colin Alworth
    @niloc132
    ....huh. so that implies that you are setting window.window = foo or something?
    Bob Lacatena
    @blacatena
    Sorry, busy day... I did things as you first described (namespace = "<window>", name="import", and just changed the path to force it to not be "cross origin". I did nothing else. The error happens within the load (traces to a line in the script being loaded).
    Not exactly the same thing. But... I'm flailing here, in that there's so much of the underlying mechanisms that I don't understand, so I'm just trying stuff, which is a horrible, horrible way to code, so I'm really going to stop at this point. I decided I'll document everything I've tried so far, and try to run it under plain Jetty as a local server to confirm that it will work then deployed, and then I'll just turn off animations while running in Eclipse, and move on (expecting them to work properly when deployed). Not great, but it lets me move forward without refactoring all of the animations into CSS. Then, some day, I'll really read up more on Javascript, JsInterop, et al, and maybe sort it out properly.
    Thanks for your help!
    Colin Alworth
    @niloc132
    @blacatena i think it would help to make a simple example so we can debug that, rather than trying to debug your app over gitter-as-a-proxy
    consider starting with a gwt maven archetype and running that (as practically no one here runs eclipse), so it can be consistently reproduced
    Bob Lacatena
    @blacatena
    I'm curious... what IDE's do people use these days? I used Intellij in the past, and tried to migrate to it, but I actually had trouble converting our projects to. My company sadly does a lot of very, very unusual things, with a 20-year-old infrastructure/codebase, so it's hard.
    Dmitrii Tikhomirov
    @treblereel
    I use Intellij and most of the time it’s great ...
    Bob Lacatena
    @blacatena
    I will try to put something together on Monday (a simple, sample application). FYI, GSAP comes in multiple forms (ESM, UMD, etc.). I tried multiple versions, and only one (the one I was using at the time of the first try with importEs6Module) gave that property-getter error. The others have a class cast exception, so maybe using those library-flavors I'm closer than I think.
    Colin Alworth
    @niloc132
    the umd format should let you skip this module work, as i understand it
    class cast exception likely just means that your jsinterop isn't quite right - give us a summary of the situation and we can probably help with that
    Bob Lacatena
    @blacatena
    Yeah, that was where I started, but I still had the problem that the loaded file was not visible to the GWT code; the problem wasn't loading the module, but rather making it visible to the native javascript methods in the GWT code. THAT was probably tied to the two-servers (8888,9876) problem, but I'm not as "in the weeds" knowledgable about that, so I don't know how to work around it.
    We quit work at 2 during the summer, so I'm done for the week, but on Monday (or if I get bored, over the weekend) I'll slap together a simple project and put it on github... but don't feel like you have to help further with this. I'm already grateful for as much as you've done. It's my own fault for not taking more time to really learn what I needed before doing.
    Colin Alworth
    @niloc132
    hmm. possible, but as long as you can reference the file with a <script> tag and have it attach to the global window object, it should "just work", ports notwithstanding. best way to start debugging that is from the plain js console, seeing if you cna use the objects directly that way
    enjoy your weekend! i'm out until tuesday, going to do three days of driving with two small children :)
    Bob Lacatena
    @blacatena
    Thx... glad my own daughter is 28! On the GSAP thing, that was what perplexed me; if I loaded the module, it was visible in Chrome if I set it in window.gsap, but window.gsap was undefined in any native JS method I ran. But knowing what I know now, maybe I should revisit my plain <script> loads to see if I can get that to work with one of the non-actual-module flavors.
    [When I first started, I thought I'd just include the <script> and move forward]
    Dmitrii Tikhomirov
    @treblereel
    @blacatena ping me when you ll have a reproduce, i ll try to help you.
    Colin Alworth
    @niloc132
    "undefined in any native JS method" sounds like you used window.gsap in jsni? using $wnd.gsap might have solved that, or better yet, use jsinterop
    Bob Lacatena
    @blacatena
    Good point. Another thing to try... I was avoiding jsinterop because I don't want to write an entire jsinterop mirror for the entire package (there is one on the Internet, but it's like 5 years old). I only have a few lines of code to port from the Vue implementation, so I figured a few short native JS methods would do the job.
    Colin Alworth
    @niloc132
    this might not be obvious, but there is no reason to write any more jsinterop than you will actually call, unless you had planned on writing a few, very complex JSNI methods (to which i would suggest you'd benefit from more, simpler jsinterop methods and keep your complexity in java)
    Bob Lacatena
    @blacatena
    Yeah, that was my original thought... but GSAP is spread over multiple plugins, and I haven't yet started to unravel all of their (the consultant's) code, so I was leery of getting into a rat's nest I'd regret.
    But... stupid of me, not to remember the $wnd not window detail. I don't use native JS often at all (old KISS guy). But that, combined with the UMD version, seems to be loading and working. That page doesn't work quite yet, but I broke so many things playing with this... I have to clean house. But I that looks like it solved my problem.
    In the words of Homer Simpson... Doh!
    Nicolas Chamouard
    @nchamouard
    is there a way with JsInterop to use the Javascript object "bracket" notation ? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors
    Ahmad K. Bawaneh
    @vegegoku
    Use JsPropertyMap
    Nicolas Chamouard
    @nchamouard
    perfect thank you