| 1 |
<!doctype html> |
| 2 |
<html lang="en-us"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> |
| 7 |
<link rel="stylesheet" href="common/testing.css"/> |
| 8 |
<title>sqlite3-api batch SQL runner for the SAHPool VFS</title> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<header id='titlebar'><span>sqlite3-api batch SQL runner for the SAHPool VFS</span></header> |
| 12 |
<div> |
| 13 |
<span class='input-wrapper'> |
| 14 |
<input type='checkbox' class='disable-during-eval' id='cb-reverse-log-order' checked></input> |
| 15 |
<label for='cb-reverse-log-order' id='lbl-reverse-log-order'>Reverse log order</label> |
| 16 |
</span> |
| 17 |
</div> |
| 18 |
<div id='test-output' class='reverse'></div> |
| 19 |
<script> |
| 20 |
(function(){ |
| 21 |
const E = (sel)=>document.querySelector(sel); |
| 22 |
|
| 23 |
const eOut = E('#test-output'); |
| 24 |
const log2 = function(cssClass,...args){ |
| 25 |
let ln; |
| 26 |
if(1 || cssClass){ |
| 27 |
ln = document.createElement('div'); |
| 28 |
if(cssClass) ln.classList.add(cssClass); |
| 29 |
ln.append(document.createTextNode(args.join(' '))); |
| 30 |
}else{ |
| 31 |
// This doesn't work with the "reverse order" option! |
| 32 |
ln = document.createTextNode(args.join(' ')+'\n'); |
| 33 |
} |
| 34 |
eOut.append(ln); |
| 35 |
}; |
| 36 |
const log = (...args)=>{ |
| 37 |
//console.log(...args); |
| 38 |
log2('', ...args); |
| 39 |
}; |
| 40 |
const logErr = function(...args){ |
| 41 |
console.error(...args); |
| 42 |
log2('error', ...args); |
| 43 |
}; |
| 44 |
const logWarn = function(...args){ |
| 45 |
console.warn(...args); |
| 46 |
log2('warning', ...args); |
| 47 |
}; |
| 48 |
|
| 49 |
const cbReverseLog = E('#cb-reverse-log-order'); |
| 50 |
const lblReverseLog = E('#lbl-reverse-log-order'); |
| 51 |
if(cbReverseLog.checked){ |
| 52 |
lblReverseLog.classList.add('warning'); |
| 53 |
eOut.classList.add('reverse'); |
| 54 |
} |
| 55 |
cbReverseLog.addEventListener('change', function(){ |
| 56 |
if(this.checked){ |
| 57 |
eOut.classList.add('reverse'); |
| 58 |
lblReverseLog.classList.add('warning'); |
| 59 |
}else{ |
| 60 |
eOut.classList.remove('reverse'); |
| 61 |
lblReverseLog.classList.remove('warning'); |
| 62 |
} |
| 63 |
}, false); |
| 64 |
|
| 65 |
const w = new Worker('batch-runner-sahpool.js?sqlite3.dir=jswasm'); |
| 66 |
w.onmessage = function(msg){ |
| 67 |
msg = msg.data; |
| 68 |
switch(msg.type){ |
| 69 |
case 'stdout': log(...msg.data); break; |
| 70 |
case 'warn': logWarn(...msg.data); break; |
| 71 |
case 'error': logErr(...msg.data); break; |
| 72 |
default: |
| 73 |
logErr("Unhandled worker message type:",msg); |
| 74 |
break; |
| 75 |
} |
| 76 |
}; |
| 77 |
})(); |
| 78 |
</script> |
| 79 |
<style> |
| 80 |
#test-output { |
| 81 |
white-space: break-spaces; |
| 82 |
overflow: auto; |
| 83 |
} |
| 84 |
</style> |
| 85 |
</body> |
| 86 |
</html> |