inclusion of scripts based on script environment

This commit is contained in:
azivner
2018-03-05 23:09:36 -05:00
parent b3209a9bbf
commit d26170762b
2 changed files with 24 additions and 3 deletions

View File

@@ -32,6 +32,18 @@ class Note extends Entity {
return (this.type === "code" || this.type === "file") && this.mime === "text/html";
}
getScriptEnv() {
if (this.isHtml() || (this.isJavaScript() && this.mime.endsWith('env=frontend'))) {
return "frontend";
}
if (this.isJavaScript() && this.mime.endsWith('env=backend')) {
return "backend";
}
return null;
}
async getAttributes() {
return this.repository.getEntities("SELECT * FROM attributes WHERE noteId = ? AND isDeleted = 0", [this.noteId]);
}