You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by JumpStart <ge...@gmail.com> on 2016/05/19 13:19:35 UTC

A scrip ahead of all other scripts

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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: A scrip ahead of all other scripts

Posted by JumpStart <ge...@gmail.com>.
Thanks Felix. That worked. I’ve now included the script, plus my options script, the theme css and language css in the TMLs that need it, and Offline is now working well.

BTW, I think Offline.js has a flaw in its init logic which could still occur sometimes. It assumes that if document.readyState is not “complete” then document event “DOMContentLoaded” must not yet have happened, which is a wrong assumption that leads to “init” not being called and therefore the UI not being set up.

By comparison, Tapestry’s jquery.js module is smarter - it listens for document event "DOMContentLoaded” and, just in case that has already happened, for window event “load”. On either of those events it removes both listeners.

> On 19 May 2016, at 10: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 <ge...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: nexus.devlab722.net down?

Posted by françois facon <fr...@gmail.com>.
Hi

The latest releases for 5.4 and 5.3 are now available at Maven Central.
https://repo1.maven.org/maven2/org/got5/tapestry5-jquery/.

Cheers

2016-05-20 8:27 GMT+02:00 Felix Gonschorek <fe...@netzgut.net>:

> Hi Ben,
>
> are you looking for tapestry5-jquery? On their website they announced that
> the devlab722 repository will close in 2015:
> https://github.com/got5/tapestry5-jquery
>
> We still have a mirror of the devlab repository in our nexus installation,
> tell me which dependency you are missing and i will have a look if we have
> it.
>
> Cheers
> Felix
>
> 2016-05-19 21:41 GMT+02:00 Ben Titmarsh <be...@hotmail.co.uk>:
>
> > Hello,
> >
> > I'm still using some dependencies from nexus.devlab722.net and have the
> > repository set up in my pom, however for the last few days the site has
> > been down.  Does anyone know what is going on?  Has the repo moved?
> >
> > http://www.downforeveryoneorjustme.com/nexus.devlab722.net
> >
> > Thanks,
> > Ben
> >
>

Re: nexus.devlab722.net down?

Posted by Felix Gonschorek <fe...@netzgut.net>.
Hi Ben,

are you looking for tapestry5-jquery? On their website they announced that
the devlab722 repository will close in 2015:
https://github.com/got5/tapestry5-jquery

We still have a mirror of the devlab repository in our nexus installation,
tell me which dependency you are missing and i will have a look if we have
it.

Cheers
Felix

2016-05-19 21:41 GMT+02:00 Ben Titmarsh <be...@hotmail.co.uk>:

> Hello,
>
> I'm still using some dependencies from nexus.devlab722.net and have the
> repository set up in my pom, however for the last few days the site has
> been down.  Does anyone know what is going on?  Has the repo moved?
>
> http://www.downforeveryoneorjustme.com/nexus.devlab722.net
>
> Thanks,
> Ben
>

nexus.devlab722.net down?

Posted by Ben Titmarsh <be...@hotmail.co.uk>.
Hello,

I'm still using some dependencies from nexus.devlab722.net and have the repository set up in my pom, however for the last few days the site has been down.  Does anyone know what is going on?  Has the repo moved?

http://www.downforeveryoneorjustme.com/nexus.devlab722.net

Thanks,
Ben
 		 	   		  

Re: A scrip ahead of all other scripts

Posted by Cezary Biernacki <ce...@gmail.com>.
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.jumpstart@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-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: A scrip ahead of all other scripts

Posted by Felix Gonschorek <fe...@netzgut.net>.
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 <ge...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>