initialization function "run" is called twice

Hello everybody,

I am displaying different adc values on a webpage served by my bbb. The BBB runs the newest software image debian 9.5 2018-10-07 4GB SD LXQT. After the initialization of bonescript function “run” is called - my problem is that “run” is called twice and reseting all variables.

The html file includes several js files:

setTargetAddress(‘192.168.7.2’, {
initialized: run
});

I pasted the “run” function below:

function run() {
if (typeof start == ‘undefined’)
{
var b = require(‘bonescript’);
var PRESSURE1 = ‘P9_33’;
var PRESSURE2 = ‘P9_36’;
var PRESSURE3 = ‘P9_38’;
var PRESSURE4 = ‘P9_40’;
var container = $("#myplot");
var totalPoints = container.outerWidth() / 2 || 250;
var pressure1 = [];
var pressure2 = [];
var pressure3 = [];
var pressure4 = [];
var time = [];
var timezero = ((new Date()).getTime());
var plotOptions = {
legend: {
position: “sw”
},

xaxis: {
min: 0,
mode: “time”,
axisLabel: ‘Zeit’,
},
yaxes: [
{
//[First axis]
min: 0,
max: 1,
axisLabel: ‘Druck [bar]’
},{
//[Second axis]
position: “right”, //set this axis to appear on the right of chart
min: 0,
max: 2,
axisLabel: ‘Verteiler [counts]’
}
]
};
var plot = $.plot(container, [
{ data: [0, 0], label: “Drucksensor 1 [bar]” },
{ data: [0, 0], label: “Drucksensor 2 [bar]” },
{ data: [0, 0], label: “Drucksensor 3 [bar]” },
{ data: [0, 0], label: “Drucksensor 4 [bar]” },
{ data: [0, 0], label: “Verteiler 1 [counts]”, yaxis: 2 },
{ data: [0, 0], label: “Verteiler 2 [counts]”, yaxis: 2 },
{ data: [0, 0], label: “Verteiler 3 [counts]”, yaxis: 2 }
] , plotOptions);

drawGraph();}

Any idea why “run” might be called twice? Any help and idea is appreciated. Thank you

Kristin