Linking

The Linker allows two components to share and synchronize data. Frequently, end users will have separate components that they want to stay in sync. A typical capital markets use case would be wanting to link several components together so that all components would share the same stock symbol: changing the stock symbol in one component would cause the other components to also change their symbol.

Using the Linker

To add the Linker icon to a component add foreign['Window Manager'].showLinker = true to its component config.

Item 1 in the image below shows the Linker icon along with a channel that this component has joined. Channels are demarcated by colors—this component is in the yellow channel. Channels are added or removed when a user clicks on a channel in the Linker window.

Item 2 shows the Linker menu and a list of colors that represent different Linker channels. By default, if a component joins a channel, it will receive all messages for that channel.

Registering components

Components must register themselves as linkable and specify linkage types. This registration and communication between components occurs automatically over the Finsemble Router via FSBL.Clients.LinkerClient. The Linker Client handles interfacing with the Router so that you can focus on passing and receiving linked information.

Links are unique to the channel and data type. Linkages are saved in the component's state.

Publish

To transmit data to other components, simply call FSBL.Clients.LinkerClient.publish whenever you want to send out an update. This will transmit the given data to all channels that the current component has joined.

    FSBL.Clients.LinkerClient.publish({
        dataType:"symbol",
        data:"AAPL"
    });
    //To send data through the linker.This will send a `symbol` object with the symbol 'AAPL` to
    //any components that is in the same channel that is listening for `symbol`

Subscribe

To receive data from other components through the Linker Client, you'll need to subscribe to a specific topic.

   FSBL.Clients.LinkerClient.subscribe("symbol", function(data){ // Symbol is the data type
        //Do something with data. Data would be "AAPL" in this case.
    });

check   The Linker allows end users to keep two or more components in sync. You must program the components to `publish` and `subscribe` the type of data that may be synced.
 

Further reading

Advanced information about linking can be found in the Linker Client documentation.

The Linker Client automatically shares data between windows based on linkage. A user can also use the Drag and Drop Client to share data. Check out Drag and Drop Sharing for more information.