RunJS tweaks
- Display result string directly instead of running through varDump() - Better detect use of `await` - Fix ESLint error
This commit is contained in:
parent
3942b0e0d5
commit
98aa71655b
1 changed files with 3 additions and 3 deletions
|
@ -29,10 +29,10 @@ async function run() {
|
|||
return;
|
||||
}
|
||||
resultTextbox.classList.remove('error');
|
||||
resultTextbox.value = Zotero.Utilities.varDump(result);
|
||||
resultTextbox.textContent = typeof result == 'string' ? result : Zotero.Utilities.varDump(result);
|
||||
}
|
||||
|
||||
function handleInput() {
|
||||
function handleInput() { // eslint-disable-line no-unused-vars
|
||||
var checkbox = document.getElementById('run-as-async');
|
||||
var isAsync = checkbox.checked;
|
||||
if (isAsync) {
|
||||
|
@ -40,7 +40,7 @@ function handleInput() {
|
|||
}
|
||||
var code = document.getElementById('code').value;
|
||||
// If `await` is used, switch to async mode
|
||||
if (/^\s*await\s/m.test(code)) {
|
||||
if (/[^=([]\s*await\s/m.test(code)) {
|
||||
checkbox.checked = true;
|
||||
update();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue