changes in access to startNote and currentNote

This commit is contained in:
azivner
2018-03-06 23:04:35 -05:00
parent 6d0218cb36
commit 766a567a32
8 changed files with 74 additions and 42 deletions

View File

@@ -11,11 +11,16 @@ const axios = require('axios');
function ScriptContext(dataKey, startNote, allNotes) {
dataKey = protected_session.getDataKey(dataKey);
const repository = new Repository(dataKey);
this.__startNote = startNote;
this.__notes = utils.toObject(allNotes, note => [note.noteId, note]);
this.__modules = {};
this.modules = {};
this.notes = utils.toObject(allNotes, note => [note.noteId, note]);
this.apis = utils.toObject(allNotes, note => [note.noteId, new ScriptApi(dataKey, startNote, note)]);
}
function ScriptApi(dataKey, startNote, currentNote) {
const repository = new Repository(dataKey);
this.startNote = startNote;
this.currentNote = currentNote;
this.axios = axios;
@@ -50,7 +55,7 @@ function ScriptContext(dataKey, startNote, allNotes) {
this.updateEntity = repository.updateEntity;
this.log = message => log.info(`Script: ${message}`);
this.log = message => log.info(`Script ${currentNote.noteId}: ${message}`);
this.getRootCalendarNoteId = date_notes.getRootCalendarNoteId;
this.getDateNoteId = date_notes.getDateNoteId;