Why is findNodesInto undefined in binding?

I want to write the number of links a node is connected to.
I’ve tried to do this to begin with:

$(go.Node, 'Spot',
        $(go.Shape, shapes.node, nodeShapeSettings(fillColor)),
        $(go.TextBlock, {editable: false, margin: 8, visible: true, alignment: go.Spot.Left},
            new go.Binding('text', '', function (data, node) {

                    console.log(node.findLinksInto)
                return 0;
            })),
        getPort(portTypes.input),
        getPort(portTypes.output),
        $(go.TextBlock, {editable: false, margin: 8, visible: false},
            new go.Binding('text', 'value')),
        supportedEvents()

but the console prints undefined… I’m curious as to why?

Node | GoJS API is a method, not a property, of the Node class.

I know, but it shouldn’t be undefined. When console logging a method in JavaScript, the implementation of the said method should be printed

Wait – your Binding is on a TextBlock, not on a Node, so the second argument to your function will not have that method defined.

Yeah… if I put it on a node, I don’t know how to display it on the textbox… do I need some additional property on my node data?

If you have any GraphObject within a Node, obj.part will evaluate to that Node.

GraphObject.part actually returns a Part, so the above also applies to all Links and Groups and plain Parts.

I currently have this:

 $(go.Node, 'Spot',
         $(go.Shape, shapes.node, nodeShapeSettings(fillColor)),
        $(go.TextBlock, {editable: false, margin: 8, visible: true, alignment: go.Spot.Left}),
        new go.Binding('text', '', function (data, node) {

            console.log(node.part);

            return 'test';
        }),
        getPort(portTypes.input),
        getPort(portTypes.output),
        $(go.TextBlock, {editable: false, margin: 8, visible: false},
            new go.Binding('text', 'value')),
        supportedEvents()

I can see the value ‘test’ is set in the console.log, but it is not displayed on the graph.