loading of custom widgets

This commit is contained in:
zadam
2019-08-17 11:28:36 +02:00
parent 53c4bb8a94
commit fd9b79e115
7 changed files with 63 additions and 12 deletions

View File

@@ -161,6 +161,7 @@ ${await note.getContent()};
} catch (e) { throw new Error("Load of script note \\"${note.title}\\" (${note.noteId}) failed with: " + e.message); }
if (!module.exports) module.exports = {};
for (const exportKey in exports) module.exports[exportKey] = exports[exportKey];
return module.exports;
}).call({}, {}, apiContext.modules['${note.noteId}'], apiContext.require(${JSON.stringify(moduleNoteIds)}), apiContext.apis['${note.noteId}']` + (modules.length > 0 ? ', ' : '') +
modules.map(mod => `apiContext.modules['${mod.noteId}'].exports`).join(', ') + `));
`;