Interface Event

Interface event emitted by Blackprint

Interface event can be listened after the node was initialized. To register a callback for an event you need to call iface.on('event.name', function(...Arguments){ })

Event Name

Arguments

Description

cable.connect

(Port, OtherPort, Cable)

Trigger when a cable was connected to a port, isOwner is boolean indicating if it was created from current node

cable.disconnect

(Port, OtherPort, Cable)

Trigger when a cable was disconnected from a port

cable.created

(Port, OtherPort, Cable)

Trigger when a cable was created from a port

port.menu *

(Port, DropDowns})

Trigger when port menu is going to be created

node.menu *

(DropDowns)

Trigger when node menu is going to be created

*

Arguments on the table above with {...} is a single object. DropDowns is an array, and you can push a callback or nested menu inside it.

iface.on('port.menu', function(data){
    data.menu.push({
        title:"With callback",
        callback:function(){...}
    });

    data.menu.push({
        title:"Callback with arguments",
        args:[1, 2],
        callback:function(one, two){...}
    });

    data.menu.push({
        title:"Callback with context",
        context:data.port,
        callback:function(one, two){
            // this === data.port
        }
    });

    data.menu.push({
        title:"When mouse over the dropdown item",
        hover:function(){...},
        unhover:function(){...},
    });

    data.menu.push({
        title:"Deep level menu",
        deep:[{
            title:"Level 1",
            deep:[{
                title:"Level 2",
                deep:[{...}]
            }]
        }]
    });
})

Last updated