[Pas2js] Variable in .LPR: How to make global through entire application?

Ulrich, Christian christian.ulrich at tcsag.de
Fri Nov 9 14:25:02 CET 2018


I must execute code as fast as possible after loading the index (Progressive Web Apps must install an handler to handle caching/updates of the page to be able to handle offline requests right)
And I want to do that before loading the rtl js and my librarys and so on and naturally long before rtl.run is called

But it would be nice to be able to handle the caching Stuff in an Pascal class and just injecting the installation of the handlers in asm in the same unit

-----Ursprüngliche Nachricht-----
Von: Pas2js [mailto:pas2js-bounces at lists.freepascal.org] Im Auftrag von Mattias Gaertner via Pas2js
Gesendet: Freitag, 9. November 2018 10:18
An: pas2js at lists.freepascal.org
Cc: Mattias Gaertner
Betreff: Re: [Pas2js] Variable in .LPR: How to make global through entire application?

On Fri, 9 Nov 2018 08:32:19 +0000
"Ulrich, Christian" <christian.ulrich at tcsag.de> wrote:

> I dont need an global var. 
> I need to register Callback functions to PWA APIs, way before rtl.run
> is called... I think there are more problems like where you want to
> inject javascript outside the rtl

Do you mean you must execute code *while* the JS is still loading?
Or do you mean you must execute code right after loading the JS, and
you want to execute run.rtl later?


Mattias

 
> -----Ursprüngliche Nachricht-----
> Von: Pas2js [mailto:pas2js-bounces at lists.freepascal.org] Im Auftrag
> von Mattias Gaertner via Pas2js Gesendet: Freitag, 9. November 2018
> 09:11 An: pas2js at lists.freepascal.org
> Cc: Mattias Gaertner
> Betreff: Re: [Pas2js] Variable in .LPR: How to make global through
> entire application?
> 
> On Fri, 9 Nov 2018 06:41:30 +0000
> "Ulrich, Christian" <christian.ulrich at tcsag.de> wrote:
> 
> > Pas2js places asm blocks always inside the "pas" scope. Is it maybe
> > an good idea to make it possible to place asm blocks after end. Or
> > before unit/programm to put it directly in the generated .js ? I had
> > yesterday an simelar problem and had to use an separate .js file
> > wich is no big problem but would be nicer to have that also beside
> > the related pascal class.  
> 
> Why do you need a global var?
> 
> Mattias
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js

_______________________________________________
Pas2js maillist  -  Pas2js at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js


More information about the Pas2js mailing list