refactored targetNote to workNote in the ScriptContext which was very confusing with relation's targetNote

This commit is contained in:
azivner
2018-08-01 10:12:54 +02:00
parent 2d24bf81dd
commit 6dc934abbe
7 changed files with 16 additions and 16 deletions

View File

@@ -1,14 +1,14 @@
import ScriptContext from "./script_context.js";
import server from "./server.js";
async function getAndExecuteBundle(noteId, targetNote = null) {
async function getAndExecuteBundle(noteId, workNote = null) {
const bundle = await server.get('script/bundle/' + noteId);
await executeBundle(bundle, targetNote);
await executeBundle(bundle, workNote);
}
async function executeBundle(bundle, targetNote) {
const apiContext = ScriptContext(bundle.note, bundle.allNotes, targetNote);
async function executeBundle(bundle, workNote) {
const apiContext = ScriptContext(bundle.note, bundle.allNotes, workNote);
return await (function () {
return eval(`const apiContext = this; (async function() { ${bundle.script}\r\n})()`);