Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
function execute() {
  const identifierArr = `${nodeName}-array`;
  const identifierIndex = `${nodeName}-index`;

  // Setup array
  if (globalContext[identifierArr] === undefined) {
    globalContext[identifierArr] = [];
  }

  if (globalContext[identifierIndex] === undefined) {
    globalContext[identifierIndex] = 0;
  }

  switch (trigger) {
    case 0: {
      // Trigger
      const index = globalContext[identifierIndex];
      const value = globalContext[identifierArr][index];
      const endOfList = globalContext[identifierArr].length <= (index + 1);

      globalContext[identifierIndex] += 1;
      return [value, index, endOfList];
    }
    case 1:
      // Set Index
      globalContext[identifierIndex] = 0;
      break;
    default: break;
  }

  return [];
}

...

In Ports

Position

Name

Message Type

Description

1

Trigger

Trigger

This port is being used to trigger the 'Array Iterate' object.

2

Reset Index

Trigger

This port is being used to reset the index of the 'Array Iterate' object.

...

Out Ports

Position

Name

Message Type

Description

1

Value

String

This port is being used to sequentially send out each value of the 'Array'.

2

Index

String

This port is being used to sequentially send out each index along the value of the 'Array'.

3

End of List

Digital

This port is being used to send out a digital message to confirm the end of the 'Array' has been reached.

...

Properties

Name

Description

Object Name

The name of the object on the canvas.

Show Code View

The switch to turn on code view for the Code Object.

Duplicate code into custom Code Object

Image Modified