There are multiple options. Adding explicit <script> in the header should
work. It can also added just before closing </body>.

<script src="${asset:offline.js}"/>
</body>

 Another option is to contribute to 'core' stack:
    @Contribute(JavaScriptStack.class)
    @Core
    public static void
setupCoreJavaScriptStack(OrderedConfiguration<StackExtension>
configuration) {
        configuration.add("offline", new
StackExtension(StackExtensionType.LIBRARY,
"classpath:META-INF/assets/offline.js"), "before:requirejs");
    }

Best regards,
Cezary



On Thu, May 19, 2016 at 4:15 PM, Felix Gonschorek <fe...@netzgut.net> wrote:

> Hi Geoff,
>
> still fighting with Offline.js ? :-)
>
> What about loading offline.js in the head of the document, with a regular
> <script src="${asset:xxx}" /> tag as a child of the <head /> tag? Tapestry
> is being loaded at the end of the document before the closing </body> tag.
>
>
>
> 2016-05-19 15:19 GMT+02:00 JumpStart <geoff.callender.jumpst...@gmail.com
> >:
>
> > In T5.4, how can I make a script load ahead of all the others, including
> > Tapestry’s js? The others load async so I think I need this one to load
> > synchronously. .
> >
> > The script is offline.js. My problem is that offline.js works only
> > sometimes - it has its own detection of DOMContentLoaded and
> > document.readyState, which I think is in a race condition with Tapestry’s
> > handling of the same thing. I think it might be fine if I can guarantee
> it
> > runs before anything else.
> >
> > A better solution would be for offline.js to be made AMD compatible,
> which
> > means exposing its “init" function so that we can use "require" to call
> > “init" after the document has loaded, but that requires hacking
> offline.js
> > which I would rather not do yet.
> >
> > Geoff
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>

Reply via email to