[Pas2js] about API Offline javascript

Michael Van Canneyt michael at freepascal.org
Thu Oct 24 23:34:37 CEST 2019



On Thu, 24 Oct 2019, Pedro Pablo Oviedo Vera wrote:

> how can I start with nodejs with pas2js ? thanks

Basically: Compile with -Tnodejs.

The lazarus IDE has a wizard to create a NodeJS app; It sets the target.

The nodejs.pas unit has some support for interacting with the proces
environment, the nodejsapp unit implements the TCustomApplication descendent
of NodeJS.

The nodejsfs.pas unit contains filesystem support for nodejs.

Michael.

>
> El lun., 21 oct. 2019 a las 17:55, Pedro Pablo Oviedo Vera (<
> verakuba13 at gmail.com>) escribió:
>
>> you're right....I'm on it now! Thanks a lot!
>>
>> El vie., 18 de octubre de 2019 5:26 p.m., Michael Van Canneyt <
>> michael at freepascal.org> escribió:
>>
>>>
>>>
>>> On Fri, 18 Oct 2019, Pedro Pablo Oviedo Vera wrote:
>>>
>>>> I'm try learn about APIOffline and I need applicationCache method from
>>>> window class....but it has not that....so I written something as a draft
>>>> ....I'm not sure....:-(...:here  I go:
>>>>
>>>> (* in order to give support to method window.applicationOffline *)
>>>> TJSnsrefcnt                   = integer;
>>>> TJSnsISupports                = class;
>>>> TJSnsIDOMOfflineResourcesList = class;
>>>>
>>>> TJSnsIDOMEventListenerEvent = TJSEvent;
>>>>
>>>> TJSnsIDOMEventListener    = reference to function(aEvent:
>>>> TJSnsIDOMEventListenerEvent):Boolean;
>>>> TJSnsVoidIDOMEventHandler = reference to procedure(aUrl: TJSDOMString);
>>>>
>>>> TJSnsIDOMOfflineResourcesList = class external name
>>>> 'nsIDOMOfflineResourcesList'(TJSnsISupport)
>>>> private
>>>> fmozItems      : TJSnsIDOMOfflineResourseList; external name 'mozItems';
>>>> fmozLength     : longint; external name 'mozLength';
>>>> fonerror       : TJSnsIDOMEventListener; external name 'onerror';
>>>> fonnoupdate    : TJSnsIDOMEventListener; external name 'onnoupdate';
>>>> fonprogress    : TJSnsIDOMEventListener; external name 'onprogress';
>>>> fonupdateready : TJSnsIDOMEventListener; external name 'onupdateready';
>>>> foncached      : TJSnsIDOMEventListener; external name 'oncached';
>>>> fstatus        : word;  external name 'status';
>>>> public
>>>> const
>>>>  UNCACHED    = 0;
>>>>  IDLE        = 1;
>>>>  CHECKIG     = 2;
>>>>  DOWNLOADING = 3;
>>>>  UPDATEREADY = 4;
>>>>  OBSOLETE    = 5;
>>>> public
>>>> procedure addEventListener(aname : string; aListener :
>>>> TJSnsIDOMEventHandler);
>>>> procedure addEventListener(aname : string; aListener :
>>> TJSRawEventHandler);
>>>>
>>>> function mozHasItem(aUrl: TJSDOMString): Boolean;
>>>> function mozItem(aIndex: longint): TJSDOMString;
>>>> procedure mozaAdd(aUrl: TJSDOMString);
>>>> procedure mozRemove(aUrl: TJSDOMString);
>>>> procedure swapCache;
>>>> procedure update;
>>>>
>>>> property mozItems  : TJSnsIDOMOfflineResourseList read fmozItems;
>>>> property mozLength : word  read fmozLength ;
>>>> property status    : word  read fstatus;
>>>>
>>>> end;
>>>>
>>>> TJSnsISupports = class external name 'nsISupport'
>>>> public
>>>>  function AddRef: TJSnsrefcnt; ??
>>>>  procedure QueryInterface(aUuid: TJSnsIIDRef?; aParams: array of
>>> JSValue);
>>>>  function Release: TJSnsrefcnt;
>>>> end;
>>>>
>>>> (* in window class .....*)
>>>> function applicationCache: TJSnsIDOMOfflineResourceList;
>>>>
>>>> .......question is......is it ok?
>>>
>>> It looks correct, but this API is deprecated.
>>> You should use service workers instead.
>>>
>>> Michael.
>>> _______________________________________________
>>> Pas2js maillist  -  Pas2js at lists.freepascal.org
>>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
>>>
>>
>
> -- 
>
> MSc. Ing. Pedro Pablo Oviedo Vera
> Dirección Técnica y Desarrollo
> Empresa de Proyectos e Ingeniería del
> Ministerio de la Agricultura.ENPA.
> Boyeros y Conill, Piso 10 Edif MINAG
> Telef. 884 7197
> SIP:23000116
>


More information about the Pas2js mailing list