support for backend jobs and other script API changes

This commit is contained in:
azivner
2018-02-24 14:42:52 -05:00
parent 5dd93e4cdc
commit a555b6319c
8 changed files with 106 additions and 11 deletions

View File

@@ -174,6 +174,8 @@ const noteEditor = (function() {
codeEditor.setOption("mode", info.mime);
CodeMirror.autoLoadMode(codeEditor, info.mode);
}
codeEditor.refresh();
}
}

View File

@@ -32,6 +32,10 @@ const server = (function() {
}
function prepareParams(params) {
if (!params) {
return params;
}
return params.map(p => {
if (typeof p === "function") {
return "!@#Function: " + p.toString();
@@ -52,6 +56,13 @@ const server = (function() {
return ret.executionResult;
}
async function setJob(opts) {
opts.job = opts.job.toString();
opts.params = prepareParams(opts.params);
await post('script/job', opts);
}
let i = 1;
const reqResolves = {};
@@ -116,6 +127,7 @@ const server = (function() {
put,
remove,
exec,
setJob,
ajax,
// don't remove, used from CKEditor image upload!
getHeaders