ioBroker.javascript icon indicating copy to clipboard operation
ioBroker.javascript copied to clipboard

Filtering of global scripts matching current instance

Open marian-t-web-de opened this issue 7 months ago • 1 comments

I'd like global scripts be filtered matching current instance. The background is, global scripts will be needed only by a part of productive scripts. In other case the debugging is buggy using global scripts and in some cases they are not needed. With above, global scripts and scripts using them could be placed in instance 0 and all other in instance 1

The solution I'd like could be an following single line coding in iobroker.javascript main.js:

1241 } else { // javascript new line if(!obj.common.engine.match(context.adapter.instance)) continue; 1242 const sourceCode = obj.common.source; 1243 globalScript += sourceCode + '\n';**

A clear and concise description of what you want to happen.

The above solution is not usable yet because "context.adapter.instance" contains (instance) 0 also in case of using/debugging scripts belonging to instance 1.

Maybe there is an another attribute containing script instance?

marian-t-web-de avatar May 16 '25 09:05 marian-t-web-de

In that case, the script is no longer "global". Maybe we should introduce a new "instance" folder. Adding that line would be a breaking change for many users.

klein0r avatar May 16 '25 10:05 klein0r