Docking

When a dizmo is moved close to another, dizmoViewer asks both of them if they allow docking. If at least one of them answers with true dizmoViewer will display a visual feedback about the docking to the user.

You can allow docking by setting the parameter to true (default is false) in the function dizmo.canDock();. However, for a successful docking, both dizmos have to set this parameter to true.

// docking disabled
dizmo.canDock(false);

// docking enabled
dizmo.canDock(true);

The function dizmo.onDock(); will notify you when another dizmo tries to dock to yours.

dizmo.onDock(function(dockingDizmo){
    console.log('Docked to dizmo with id ' + dockingDizmo.identifier);
});

The function dizmo.onUnDock(); will notify you when an already docked dizmo undocks, that is disconnects.

dizmo.onUndock(function(dockingDizmo){
    console.log('undocked');
});

Make data available for the docked dizmo

Docked dizmos exchange data via the public property stdout:

publicStorage.setProperty('stdout');
publicStorage.getProperty('stdout');

Take a look at the chapter Communication between dizmos for an in-depth explanation of how dizmos exchange data.