Js noob question

I want to start a timer in a js. here is my js:

Inputs: none;
Outputs: result (number)

result = 0;

function meineFunktion() { 
    result = result + 1;
    return {result};

setInterval(function() { 
    // jede Sekunde ausführen 
}, 1000);

why the js output is not triggered?

i just want to start a timer and write every second the new time in an app var.

here i tried with alert. the alerts are shown each second. but the output of the js is not set each second. why?

x = 0;

function meineFunktion() { 
    x = x + 1;
    return {result: x};

setInterval(function() { 
    // jede Sekunde ausführen 
}, 1000);

in the meantime I have solved it differently… if someone should still answer here I would be interested in what you have to pay attention to so that it works with the output of values. Is there somewhere simple examples?

this seems to me to be more of a self-help forum than anything else… has it always been like this or only since SAP bought out the store?

Hi, I haven’t tried to use an interval within the JS so I don’t know if the output should trigger with that code, but the “native” Composer way to do this is to use a Delay node to run the code at intervals, which you might have already done. :slight_smile:


To answer your other concerns, we do our best to support you guys, but since we are a small team without any dedicated user support personnel at the moment, it sometimes takes a while for us to reply. Thanks for your understanding!

Thanks for your answer!

Maybe the problem with my JS seems to be that at the start of the script all inputs “freeze” and can’t be updated while the script is running…? It would be nice if you got some examples of how to use JS?

Other Questions:

  • how can i style a Slider or toggle color… is that possible?
  • is it possible to trigger a onTap event from another button?

for example if i press button A i would like to trigger an “on tap event” on button B. possible?

The sliders and toggles aren’t customizable at the moment. You can toggle a tap event of another using “Tap component” flow function – I suggest using buttons for this, there is a known bug at the moment with the flow function if you use it with another type of component or a composite.

For JS instructions, check out this page in the docs. The inputs are evaluated each time you run the code, so for example if you have a JS node that gets executed every 10 seconds and an input that is bound to an app variable, and that app variable changes in between the executions, it should get an up-to-date value.

Thanks, i’ll try that out!

1 Like