[Pas2js] about API Offline javascript

Pedro Pablo Oviedo Vera verakuba13 at gmail.com
Fri Oct 18 22:34:20 CEST 2019


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?
-- 

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20191018/6e0bdcbd/attachment.html>


More information about the Pas2js mailing list