sql.js
sql.js copied to clipboard
Have any property of worker.sql.js to check datebase is ready?
I want to know the status of my web worker.sql. No demo show me the way. Anyone can help?
In the source code (for worker version), there is a postMessage ready event. Are you calling open and listening on the browser/client for messages back?
sqlModuleReady.then ->
data = event['data']
switch data?['action']
when 'open'
buff = data['buffer']
createDb (if buff then new Uint8Array(buff) else undefined)
postMessage
'id': data['id']
'ready': true
I use a seperate message passing library like callbag-subject or worker-rpc etc, with an observable/subscribe method to talk back and forth. It allows notifying the browser/client without polling.