Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions docs/creating-nodes/first-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,24 @@ For more information about the runtime part of the node, see [here](node-js).

```html
<script type="text/javascript">
RED.nodes.registerType('lower-case',{
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value:""}
},
inputs: 1,
outputs: 1,
icon: "file.svg",
label: function() {
return this.name||"lower-case";
}
});
// Isolate the code in a function to avoid global variable leaks
(function () {
'use strict'

RED.nodes.registerType('lower-case',{
category: 'function',
color: '#a6bbcf',
defaults: {
name: {value:""}
},
inputs: 1,
outputs: 1,
icon: "file.svg",
label: function() {
return this.name||"lower-case";
}
});
}());
</script>

<script type="text/html" data-template-name="lower-case">
Expand Down
11 changes: 8 additions & 3 deletions docs/creating-nodes/node-html.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ This function takes two arguments; the type of the node and its definition:

~~~~html
<script type="text/javascript">
RED.nodes.registerType('node-type',{
// node definition
});
// Isolate the code in a function to avoid global variable leaks
(function () {
'use strict'

RED.nodes.registerType('node-type',{
// node definition
});
}());
</script>
~~~~

Expand Down