Hi there.
It's still a work in progress, but we would be glad to hear what you think of it.
What I think is the following: this is very neat!
With the above said, I have one roadblocker and two minor issues (disclaimer: I'm a *complete* NB in Vue.js).
The roadblocker:
======================
You are converting the Java/GWT representation of a Vue component into the one Vue expects by using a runtime introspection of the VueComponent object from within JavaScript.
Because of this approach, you are putting properties in data {} which are NOT declared as a @JsProperty in Java. You know, internal private members that I might have in my Vue component ending on _g$, like an EventBus instance or you-name-it.
The problem with this is that the conversion fails in JSON.parse() with a "Converting circular structure to JSON" complaint.
Given that it is not very realistic - especially in hybrid Vue/GWT Widget projects to have all props marked as @JsProperty, and all of these to be non-circular, this probably needs to be addressed.
An idea: since you are anyway using naming conventions (a computed_ prefix for computed props, a watch_ prefix for watchers), how about applying this to ALL props that should end in data {} and perhaps to all methods that should end in methods {}?
Perhaps you can fix it so that it processes only methods and properties that are starting with e.g. a single "$" or suchlike?
NOTE: That might have the additional benefit that these methods and properties might not necessarily have to be marked with @JsMethod/JsProperty, as you - in fact - don't care about their name being preserved from Java to JS, as long as it starts with a "$".
Another idea: you are anyway filtering out some GWT methods, like those starting with "$init" or with "___" (the latter might be dangerous btw as it is a bit too generic!), so you can just as well filter out everything that ends with _g$ as well, because that's the mangling suffix GWT puts on all props and methods which had not been exposed via @JsProperty / @JsMethod / @JsType annotations. Of course this relies on GWT internals and might break in future, but I don't think there will be a perfect, pure and clean solution anyway if a JS object introspection is used.
Now, even if the above is addressed (and I think it should as the programmer has to have control what ends up in data {} and methods {}), the whole "return JSON.parse(JSON.stringify(data));" approach is not giving me a warm fuzzy feeling. Is that how Vue is supposed to work? With non-circular data {} only?
Two minor issues:
=========================
1. Having the project published in Maven Central soon would be nice - even if it is just a snapshot.
2. I was missing a "<script src="https://unpkg.com/vue/dist/vue.js"></script>" include and it took me some time to realize it. If VueGwt indeed does not inject the vue.js lib, this has to be at least mentioned in the GitHub README.md file.
*Keep up the good work!*
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