Class: LinkerClient

Linker Client

Public API for The Linker Service

The Linker Client acts as an API between components and the Linker Service. The Linker Client allows for sharing of data between components such as when a symbol or an account changes in one window, it can be changed in all Linked windows automatically. See our tutorial on Linking Components.

When a Component is "linked", it is added to a Linker group. Linker groups are not related to Docking groups. All clients belonging to a Linker group can subscribe and receive published items for any dataType on the same group.

Methods

addToGroup
(groupName, client, cb)

clients/linkerClient.js, line 208

Add a client to a Linker group programatically. Clients will receive all items published to this group. The Window manager uses this internally to add a component to a group when the user clicks on a color in the Linker Window.

Name Type Description
groupName string

Group to add to

client windowIdentifier

Window Identifier for the client (optional)

cb LinkerClient~groupsCB optional

Returns all the groups for the client

Example
LinkerClient.addToGroup("group1", null, callback); // Automatically uses current window if no windowIdentifier is specified
LinkerClient.addToGroup("group1", windowIdentifier, callback);

getAllGroups
(cb)

clients/linkerClient.js, line 320

Get all Linker groups

Name Type Description
cb LinkerClient~groupsCB optional

callback with all linker groups

Example
LinkerClient.getAllGroups(callback)

getGroups
(client, cb)

clients/linkerClient.js, line 337

Get all Linker groups that a window has been added to

Name Type Description
client windowIdentifier

(optional) Window Identifier for the client. If

cb LinkerClient~groupsCB optional

callback to be called on success

Example
LinkerClient.getGroups(windowIdentifier, callback)

getLinkedWindows
(params, cb)

clients/linkerClient.js, line 531

Get Linked Windows that match given parameters. If no parameters are specified, will return all linked windows.

Since:
  • 1.5
Name Type Description
params object

Optional

Name Type Description
groups array

Restrict to these groups.

componentTypes array

Restrict to these componentTypes

client windowIdentifier

Will also restrict to this client's groups.

cb function

Callback with a list of linkedWindows and their groups

Example
LinkerClient.getLinkedWindows({groups: ['group1']}, function(err, response) {
	//response contains:
	//[{windowName: 'Window Name', componentType: 'Component Type', uuid: 'uuid', groups: ['group1'] }, ..]
})

openLinkerWindow
(cb)

clients/linkerClient.js, line 419

Sends a router query on the "Finsemble.LinkerWindow.Show" channel with the current window's groups, windowIdentifier and windowBounds. For an example of how to use this to build a UI to use the Linker see our Window Title Bar and Linker Sample components

Name Type Description
cb function optional

callback to be called on success

Example
LinkerClient.openLinkerWindow(cb)

publish
(params, cb)

clients/linkerClient.js, line 464

Publish data to all listeners for a group and data type.

Name Type Description
params Object
Name Type Description
dataType String

The data type sending

data any

the data being transmitted

cb function optional

callback to be called on success

Example
LinkerClient.publish({dataType:"symbol",data:"AAPL"})

removeFromGroup
(groupName, client, cb)

clients/linkerClient.js, line 265

Removes a client from a Linker group programatically. The Window manager uses this internally to remove a component from a group when the user clicks on a color in the Linker Window corresponding to a Linker group that the window belongs to.

Name Type Description
groupName string

Group to remove

client windowIdentifier

Window Identifier for the client (optional)

cb LinkerClient~groupsCB optional

Returns all the groups for the client

Example
LinkerClient.removeFromGroup("group1", null, callback); // Automatically uses current window if no windowIdentifier is specified
LinkerClient.removeFromGroup("group1", windowIdentifier, callback)

subscribe
(dataType, cb)

clients/linkerClient.js, line 490

Registers a client for a specific data type that is sent to a group.

Name Type Description
dataType String
cb function optional

a function to be called once the linker receives the specific data.

Example
LinkerClient.subscribe("symbol",func)

unSubscribe
(dataType, cb)

clients/linkerClient.js, line 449

Remove a listener to the specified group and data type

Name Type Description
dataType String

The data type be subscribed to

cb function optional

callback to be called on success

Example
LinkerClient.subscribe("group1","symbol",cb)

Type Definitions

groupObject

Linker group

Properties:
Name Type Description
name string
color string
border string

groupCB
(err, responseMessage)

clients/linkerClient.js, line 751

Callback that returns a list of groups in the responseMessage

Name Type Description
err Object
responseMessage LinkerClient~groups