subscribe method attaches a subscription handler to a cross-source or same-source link (filter). Each time a new cross-visual filter is published to the link, the subscription handler is called and passed the newly published filter.
When you call the
subscribe method, the
unsubscribe function is returned. Run the
unsubscribe function to remove the handler for the link. This guarantees that the handler will no longer be notified when new messages are published for the link.
Messages passed on the channel can be an arbitrary message object or
null. Because the message objects are not restricted, the subscription handler should never assume its structure and always check that the message is in the structure the handler is expecting.
Messages that are
null are interpreted as a clearing of the channel and should be handled by undoing any actions taken based on the last messages received by the handler. For example, when a Composer visual receives a
null message in its filtering logic, it removes any filters created by previous messages on the given channel (link).
If a message is published to the channel before the
subscribe method is called, the subscription handler is executed immediately with the latest message that was published on the channel.
The properties for the