[Pas2js] Project SQLite for pas2js

warleyalex warleyalex at yahoo.com.br
Tue Sep 22 20:38:56 CEST 2020


OK, It is a bit of investigation, and no need to Disable Cache at developer
tools,

Look at the following method (the fetch method with the object
initialization {cache: "no-store"}) 

{  Open Async local Sqlite Database file }
procedure OpenSQLiteDBFile(path: String; callBackDB: TProcedureSQLDB);
async;
var
  fetched: TJSResponse;
  buf: TJSPromise; //TJSArrayBuffer;
  dataDB: TJSUint8Array;
begin
  fetched := await(window.fetch( path, new(['cache', 'no-store']) ));
  buf := await (fetched.arrayBuffer());
  dataDB:= TJSUint8Array.New( TJSArrayBuffer(buf) );
  callBackDB( TJSSqliteDatabase.New( dataDB )); 
end;    


By the way, I had to edit web.pas, I think the correct definition of the
following method would be correct;

function fetch(resource: String; init: TJSObject): TJSResponse;
{TJSPromise;} overload; external name 'fetch';





--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list