[Pas2js] pas2js WebAssembly SQLite demos

Pierce Ng pierce at samadhiweb.com
Tue Feb 24 05:05:36 CET 2026


On Mon, Feb 23, 2026 at 10:00:07PM +0100, Michael Van Canneyt via Pas2js wrote:
> Importscript exists in webworker unit ?
>   Self_.ImportScripts();

Not in my installation. Ah, I'm not running the latest stuff. :-)

This is my pas2js:

  commit 9ac46614dc8252a44b21346f967dd7d2a87bfeba (HEAD, tag: release_3_2_0, origin/fixes_3_2)
  Author: mattias <nc-gaertnma at netcologne.de>
  Date:   Sat Jul 26 09:49:10 2025 +0200
  
      rtl: less hints

Built with this version of FPC:

  commit 5d768f725c6748ddacef547fe74e6e8163347c4e (HEAD -> main, origin/main, origin/HEAD)
  Author: Michaël Van Canneyt <michael at freepascal.org>
  Date:   Thu Jan 8 15:50:39 2026 +0100
  
      * Remove packed from TXYZReferenceWhite and put Illuminant at the end

> >  asm
> >    importScripts('/dist/sqlite3.js');
> >    globalThis.sqlite3InitModule().then(function(sqlite3){
> >      self.sqlite3 = sqlite3
> >    });
> >  end;
> 
> See above, Self_ exists in webworker. It cannot be 'self' since that is a reserved word
> in pas2js.

I meant doing it all in Javascript wrapped in an asm block, so 'self'
and 'globalThis' were Javascript symbols.

> > I'll publish my demos as a code repo somewhere somewhen. Meanwhile,
> > thanks to Javascript source maps, all Pascal code is accessible in the
> > browser debugger.
> > 
> > Next demo, unlikely any time soon, will probably be importing an
> > existing SQLite database into the browser.
> 
> Well, If you're OK with that, I would love to convert it to an example in
> https://live.freepascal.org/ :-)

Sure, please, go ahead.

Pierce


More information about the Pas2js mailing list