I would like to use the value of nodeMessageBufferMaxLength
defined in settings.js
in the edit dialog of a custom node. It is available as RED.settings.nodeMessageBufferMaxLength
in the .js file, but I don't seem to be able to access it in the .html file.. I have tried using it in the oneditprepare
function and in the defaults
object, but in each case the value returned is undefined
. Is there a reason for this, or am I making some mistake?
No, you can't access them directly from the editor.
A sanitised copy of some of the settings are passed to the editor, but it only contains editor specific settings.
What problem are you trying to solve by having it available to the configuration dialogue?
Less of a problem than a feature...
My node-red-contrib-queue-gate node allows the user to limit the number of messages in the queue. The default value is currently fixed at 100, but I would like it to be nodeMessageBufferMaxLength
for consistency with the core nodes that honor this setting. The user could then set it as he/she likes.
You can pass data from the back end to the front using the settings option in registerType:
The var names must start with the name of your node.
If you need anything more complex/dynamic, you need to use an API.
Thanks for that, Julian.
I remember glancing at that bit of the documentation and thinking "too clever, I'll never need that." It's exactly what I needed.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.