mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Add worker-style variant of the tests added in [ae24ac0f7dd9], but building this with wasmfs causes them to throw inexplicable exceptions from the Emscripten glue (without wasmfs it builds and runs fine, but storage is not persistent).
FossilOrigin-Name: 6401595e59179c5c0f6e51c5362cf4391787e7a55b9c6ca655746e30d3251f2b
This commit is contained in:
33
ext/wasm/scratchpad-opfs-worker.js
Normal file
33
ext/wasm/scratchpad-opfs-worker.js
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
2022-05-22
|
||||
|
||||
The author disclaims copyright to this source code. In place of a
|
||||
legal notice, here is a blessing:
|
||||
|
||||
* May you do good and not evil.
|
||||
* May you find forgiveness for yourself and forgive others.
|
||||
* May you share freely, never taking more than you give.
|
||||
|
||||
***********************************************************************
|
||||
|
||||
A basic test script for sqlite3-api.js. This file must be run in
|
||||
main JS thread and sqlite3.js must have been loaded before it.
|
||||
*/
|
||||
'use strict';
|
||||
(function(){
|
||||
const toss = function(...args){throw new Error(args.join(' '))};
|
||||
const log = console.log.bind(console),
|
||||
warn = console.warn.bind(console),
|
||||
error = console.error.bind(console);
|
||||
|
||||
const W = new Worker("api/scratchpad-opfs-worker.js");
|
||||
self.onmessage = function(ev){
|
||||
ev = ev.data;
|
||||
const d = ev.data;
|
||||
switch(ev.type){
|
||||
case 'stdout': log(d); break;
|
||||
case 'stderr': error(d); break;
|
||||
default: warn("Unhandled message type:",ev); break;
|
||||
}
|
||||
};
|
||||
})();
|
Reference in New Issue
Block a user