JavaScript payload formatters allow you to write functions to encode or decode messages. JavaScript functions are executed using an JavaScript ECMAScript 5.1 runtime.
Tips:
- The payload formatters should be simple and lightweight.
- Use arithmetic operations and bit shifts to convert binary data to fields.
- Avoid using non-trivial logic or polyfills.
Note:
Payload formatters use ECMAScript 5.1 (2009), which has some distinct differences compared to newer, commonly used ECMAScript revisions. See here for a quick comparison.
For security, the runtime does not support modules (require
syntax) or any network or file system access.
Warning:
The maximum size of a JavaScript payload formatter is 40KB (40,960 bytes). Payload formatters loaded from the Device Repository can be larger.Learn more about payload formatters and examples: