Class: Connector

saij/connection/Connector~Connector


import Connector from 'saij/connection/Connector';

A connector is a helper class, that you can instantiate with an id generating function, that when connect is called between two module:saij/connection/Connection~Connectables, an id will be created and a new module:saij/connection/Connection~Connection will be returned.

new Connector(keyFunction, opt_type)

Create the Connector class with a function that will take two module:saij/connection/Connection~Connectables and create a key from them.

const keyFunction = (conA, conB)=> `${conA.getName()}:${conB.getName()}`
const connector = new Connector(keyFunction, 'simplex');
const connection = connector.connect(conA, conB);
Name Type Description
keyFunction module:saij/connection/Connector~ConnectionKeyFunction

key string creating function

type module:saij/connection/ConnectionType

optional connection type

Methods

Create a new connection between two connectables, using the keyFunction and type provided to generate a new connectionKey.

Name Type Description
conA module:saij/connection/Connection~Connectable

connection A

conB module:saij/connection/Connection~Connectable

connection B

conA.getInput function

returns module:saij/core/Object~BaseObject

conA.getOutput function

returns module:saij/core/Object~BaseObject

conB.getInput function

returns module:saij/core/Object~BaseObject

conB.getOutput function

returns module:saij/core/Object~BaseObject

Returns:
new connection