Additional Code-Cleanup

closes #2
- removed constant cache variable in server.js
- renamed second data variable in script.js
- removed variable vueApp in data.js
pull/4/head
Trivernis 6 years ago
parent 2b7c88596a
commit 3a0cfef640

@ -7,7 +7,7 @@ function bindData(){
let mods = $('model');
mods.each(function(){
let model = $(this);
if (model.attr('refresh-interval') != undefined) {
if (model.attr('refresh-interval') !== undefined) {
bindModelData(model);
setInterval(()=> { bindModelData(model) }, model.attr('refresh-interval'));
}
@ -16,11 +16,11 @@ function bindData(){
}
function bindModelData(model) {
$.get(model.attr('src'), function(data){
$.get(model.attr('src'), function(data) {
$('*[model='+model.attr('name')+']').each(function() {
let elem = $(this);
let data = getDataByPath(JSON.parse(data), elem.attr('datapath'));
this.setAttribute(":data", data);
let dat = getDataByPath(JSON.parse(data), elem.attr('datapath'));
this.setAttribute(":data", dat);
//elem.html();
})
});
@ -28,7 +28,7 @@ function bindModelData(model) {
/**
* Returns the data of an array by accessing the given path-string
* @param {JSON-Object} array Contains the data.
* @param {Object} array Contains the data.
* @param {String} path The path to the wanted data.
* @return {Object} Returns anything that the path points to.
*/

@ -1,14 +1,12 @@
{
{
"license": "GPL-v3",
"dependencies": [
"args-parser",
"https",
"jquery",
"jsdom",
"node-sass",
"perfy",
"vuejs",
"winston-daily-rotate-file",
"winston"
]
"dependencies": {
"args-parser": "^1.1.0",
"jquery": "^3.3.1",
"jsdom": "^12.2.0",
"node-sass": "^4.9.3",
"perfy": "^1.1.5",
"winston-daily-rotate-file": "^3.3.3",
"winston": "^3.1.0"
}
}

@ -1,13 +1,13 @@
function getFormattedData(dataArray) {
let arrData = ["0,100"];
for (d of dataArray) {
for (let d of dataArray) {
arrData.push(d[0]+","+(100-d[1]));
}
arrData.push("100,100");
return arrData.join(" ");
}
var vueApp = new Vue({
new Vue({
el: '#app',
data: {
temperatureData: [1,2,3,4],

@ -74,8 +74,7 @@ const https = require('https'),
"mime": "text/javascript"
}
},
mounts = config.mounts, // mounts are more important than routes.
cache = {}; // cache stores filenames for cached processed files
mounts = config.mounts; // mounts are more important than routes.
// --- functional declaration part ---

Loading…
Cancel
Save