Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add the 「run」 directive for the webWorker
Add the 「run」 directive for the webWorker
  • Loading branch information
Sola committed Jul 31, 2017
commit ed9c56f9281363fd932787358eab0919bbc7e212
7 changes: 7 additions & 0 deletions coffee/worker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ if typeof importScripts is 'function' # Detect webworker context
postMessage
'id' : data['id']
'results': db.exec data['sql']
when 'run'
if db is null then createDb()
if not data['sql'] then throw 'run: Missing query string'
if not data['params'] then throw 'run: Missing params'
postMessage
'id' : data['id']
'results': db.run data['sql'], data['params']
when 'each'
if db is null then createDb()
callback = (row) -> postMessage
Expand Down