Skip to content

Filtering of global scripts matching current instance #1863

Open

Description

@manni-2x

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?

Activity

  1. klein0r commented on May 16, 2025

    @klein0r
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions