The short answer is yes, it can all go into one method, or several methods,
etc. The important part is "what does that JS expect to do", and how might
we accidentally break it by letting a compiler at it.

With that big of a file, I'm afraid I don't have time right now to take it
apart piece by piece and see what might break. Also, this is really the
wrong venue for a question not about contributing to GWT - I suggest
continuing on the regular GWT mailing list, a stackoverflow post, or in
gitter.im/project/gwt or in the ##gwt channel in freenode.

On Thu, Dec 31, 2015 at 4:38 AM confile <[email protected]>
wrote:

> Okay, When I put the code of the external JS file in a JSNI method. Do I
> have to put all the code I one method? To have a concrete example here is
> the code I use:
>
>
> https://github.com/Atmosphere/atmosphere-javascript/blob/master/modules/javascript/src/main/webapp/javascript/atmosphere.js
>
> Could you please give an example of how you would do it in this case?
>
>
> Am Donnerstag, 31. Dezember 2015 01:17:44 UTC+1 schrieb Colin Alworth:
>
>> It depends on how you are including the JavaScript source.
>>
>> If it is a <script> tag in the .gwt.xml or the html host page, the GWT
>> compiler barely knows it exists, and will do nothing with it. Likewise, if
>> you use the ScriptInjector to make it available to the app, either from a
>> url, or from a String or External/TextResource - as far as GWT can tell,
>> its just a String.
>>
>> If on the other hand you put it into a JSNI method, the compiler will
>> understand that it is source and should be optimized as much as possible.
>> Note however that JSNI is limited in how it can be optimized, though
>> enabling the Closure compiler can often do a more comprehensive job of
>> cleaning up that JS source, though this cleanup may in some cases break
>> code that isn't prepared to be optimized in that way.
>>
>> On Wed, Dec 30, 2015 at 4:11 PM confile <[email protected]>
>> wrote:
>>
>>> I have an external JavaScript file which I use using JSNI or JS Interop.
>>>
>>> I only use parts of this js file/ library.
>>>
>>> *Is it possible to reduce the code of this external js file using GWT?*
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "GWT Contributors" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected]
>>> .
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-web-toolkit-contributors/4b0d67b6-ba5c-42d9-a5ff-894f7eccd752%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/4b0d67b6-ba5c-42d9-a5ff-894f7eccd752%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/fcb0b0e1-fd98-48d8-bef4-8d63ce47af4d%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/fcb0b0e1-fd98-48d8-bef4-8d63ce47af4d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CADcXZMy9g5MLC5oKaVhPjKJcpCJS0SgnpbDEu1ZTMhOuYVPmHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to