Files
EVOLV/wiki/manuals/node-red/runtime-node-js.md
znetsixe 5ae8788fd7 wiki: crisp overhaul — no decoration emoji, all 9 master pages refactored
Source-tree mirror of EVOLV.wiki.git refactor (27a42ee on wiki.git):

- 7 master pages rewritten with clean design (Home, Architecture,
  Topology-Patterns, Topic-Conventions, Telemetry, Getting-Started,
  Glossary). Tables and Mermaid for visuals, gitea alert callouts for
  warnings, shields badges for metadata only. No emoji as decoration.
- Archive.md becomes a removal-changelog pointing readers to git
  history and to the successor pages.
- _Sidebar.md updated to navigate the new flat-name layout.
- Concept / finding / manual pages: uniform mini-header (badges +
  "reference page" callout) added without rewriting domain content.
- Every internal link now uses the flat naming that resolves on the
  live gitea wiki (Concept-ASM-Models, Finding-BEP-..., etc.).

On wiki.git: 29 Archive-* pages hard-deleted (the git history
preserves them; Archive.md documents the removal).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 22:24:51 +02:00

38 lines
1.4 KiB
Markdown

# Node-RED Runtime Node JS Manual (EVOLV Summary)
![code-ref](https://img.shields.io/badge/code--ref-9ab9f6b-blue) ![type](https://img.shields.io/badge/type-manual_(third-party)-orange)
> [!NOTE]
> Reference page. Maintained for context; not regenerated by code. See [Home](Home) for current top-level navigation.
Based on: https://nodered.org/docs/creating-nodes/node-js
## Input Handler Contract
- Node-RED calls runtime handlers as `function(msg, send, done)`.
- For compatibility, custom nodes should support fallback behavior when `send` is not provided.
- Use `done()` on successful completion and `done(err)` on failure.
## Output Routing Rules
- For single-output nodes: `send(msg)` sends on output 1.
- For multi-output nodes: pass an array with one slot per output, for example:
- `[msg, null, null]` => output 1 only
- `[null, msg, null]` => output 2 only
- Always construct the outbound message first, then send it.
## EVOLV Runtime Pattern
Recommended runtime input structure for `src/nodeClass.js`:
1. Normalize `send` fallback.
2. Wrap `switch(msg.topic)` in `try/catch`.
3. Route response messages to explicit output index with array format.
4. Call `done()`/`done(err)` consistently.
## Common Failure Mode
- Sending a bare object in a multi-output context can hide intended port routing.
- In EVOLV nodes with 3 outputs (`process`, `dbase`, `parent`), use explicit arrays for deterministic wiring behavior.