mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Initial bits for a JS API variant in which the client operates in the main thread and sqlite3 in a Worker. This is far from complete.
FossilOrigin-Name: f6d6f969791f0d2367ae5418623b4794f6df657d9d7d9002fb5aec4206dcfd4c
This commit is contained in:
35
ext/fiddle/sqlite3-worker.js
Normal file
35
ext/fiddle/sqlite3-worker.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
2022-05-23
|
||||
|
||||
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.
|
||||
|
||||
***********************************************************************
|
||||
|
||||
UNDER CONSTRUCTION
|
||||
|
||||
This is a JS Worker file for the main sqlite3 api. It loads
|
||||
sqlite3.js and offers access to the db via the Worker
|
||||
message-passing interface.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
(function(){
|
||||
/** Posts a worker message as {type:type, data:data}. */
|
||||
const wMsg = (type,data)=>self.postMessage({type, data});
|
||||
self.onmessage = function(ev){
|
||||
/*ev = ev.data;
|
||||
switch(ev.type){
|
||||
default: break;
|
||||
};*/
|
||||
console.warn("Unknown sqlite3-worker message type:",ev);
|
||||
};
|
||||
importScripts('sqlite3.js');
|
||||
initSqlite3Module().then(function(){
|
||||
wMsg('sqlite3-api','ready');
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user