You're in control of the app, so if that setup works for you, go for it! We usually recommend people load any element dependencies in the same html import that defines the <dom-module>. This makes the element portable and resuable, but that might not be a requirement for your project.
On Fri, Sep 4, 2015 at 4:43 PM Kun Li <[email protected]> wrote: > Thanks for your answer Eric. > > In our project, we load all global javascript files in the root level > "index.html" file, which also imports the element.html file which includes > all the components related import. Then we assume that all components can > safely use the variables in those global javascript files. Plus, all the > non-polymer codes can also use those global variables. > > It's working so far, but I wonder if you see hidden trap of this approach. > One thing I'm not sure is, since element.html is imported in the head, > while all the global javascript files are loaded in the end of body, could > it be possible that when Polymer components are ready, some of the js files > are not loaded yet, hence the error of undefined variable could happen? > > Thanks in advance! > > On Fri, Sep 4, 2015 at 3:47 PM Eric Bidelman <[email protected]> wrote: > >> If you use that script in another place in your app, it's going to load >> + execute again. Using an import will de-dupe the URL and prevent that. >> >> On Fri, Sep 4, 2015 at 4:10 PM Kun Li <[email protected]> wrote: >> >>> What is the advantage of doing this instead of just include "<script src >>> ='../marked/lib/marked.js'></script>" into the element script section? >>> >>> >>> On Wednesday, September 2, 2015 at 11:56:39 AM UTC-6, Eric Bidelman >>> wrote: >>> >>>> You can create an html import for jquery.js, similar to what >>>> https://github.com/PolymerElements/marked-element/blob/master/marked-import.html >>>> does >>>> for marked.js and import that as a dependency to your element. Like >>>> this >>>> <https://github.com/PolymerElements/marked-element/blob/master/marked-element.html#L11> >>>> . >>>> >>>> On Wed, Sep 2, 2015 at 10:40 AM <[email protected]> wrote: >>>> >>> Salut a tous, quelqu'un a une idée de la façon dont utiliser jquery >>>>> dans les web components de google? >>>>> >>>>> Follow Polymer on Google+: plus.google.com/107187849809354688692 >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Polymer" 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/polymer-dev/f50b3eb9-5cad-42e4-8afe-2f5372f187ad%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/polymer-dev/f50b3eb9-5cad-42e4-8afe-2f5372f187ad%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> Follow Polymer on Google+: plus.google.com/107187849809354688692 >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Polymer" 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/polymer-dev/84387a9f-1537-42e8-a1ce-f4096e7abce1%40googlegroups.com >>> <https://groups.google.com/d/msgid/polymer-dev/84387a9f-1537-42e8-a1ce-f4096e7abce1%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" 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/polymer-dev/CACGqRCD7d9MZTUNr76x4pocajEj2tAcF%3D2nW1WdYOdJE8GR_xg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
