Arrow syntax in RED.nodes.registerType

I just tried to replace

		label: function() {
			return this.name;
		},

with

label: () => this.name,

and it didn't work. Is this expected? Obviously not important, just wondering if I am doing something silly

That is expected to not work. You should not use arrow functions in a node definition.

Unlike regular functions, arrow functions don't get their own this. Which means the function would have no way of addressing the node instance it is being called for.

1 Like

Many thanks.....

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.