<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>messaging JavaScript API Module</title><link>https://community.telligent.com/community/11/w/api-documentation/65018/messaging-javascript-api-module</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>messaging JavaScript API Module</title><link>https://community.telligent.com/community/11/w/api-documentation/65018/messaging-javascript-api-module</link><pubDate>Tue, 19 Nov 2019 20:28:30 GMT</pubDate><guid isPermaLink="false">35ff81b0-fbfe-4b23-8eba-7fcad96404fa</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/65018/messaging-javascript-api-module#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:28:30&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_messaging" name="jQuery_telligent_evolution_messaging"&gt;&lt;/a&gt;jQuery.telligent.evolution.messaging&lt;/h3&gt;
&lt;p&gt;This module provides a simple, generic publish/subscribe message bus for client code to use to communicate within the current document, or across documents in separate windows or tabs. This enables easy cross-widget communication without relying on expectation of specifc DOM elements or events. Additionally, the platform uses messages for coordinating synchronization between separate UI components related to the same piece of content.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Methods" name="Methods"&gt;&lt;/a&gt;Methods&lt;/h3&gt;
&lt;h4&gt;&lt;a id="subscribe" name="subscribe"&gt;&lt;/a&gt;subscribe&lt;/h4&gt;
&lt;p&gt;Subscribes to a message, and returns a subscription handle.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;var subscriptionId = $.telligent.evolution.messaging.subscribe(messageName, function(data) {
    // handle message
});

var subscriptionId = $.telligent.evolution.messaging.subscribe(messageName, namespace, function(data) {
    // handle message
});
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;messageName&lt;/code&gt;: message to subscribe to&lt;/li&gt;
&lt;li&gt;&lt;code&gt;namespace&lt;/code&gt;: optional namespace string or array of namespace strings to allow clearing one or many multiple handlers later without having subscription handles&lt;/li&gt;
&lt;li&gt;&lt;code&gt;handler&lt;/code&gt;: message handler&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a id="publish" name="publish"&gt;&lt;/a&gt;publish&lt;/h4&gt;
&lt;p&gt;Publishes a message. All current subscriptions will be called and passed the &lt;code&gt;data&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Publish a message
$.telligent.evolution.messaging.publish(messageName, data);
// Optionally publish a message that will received by handlers on other windows or tabs
$.telligent.evolution.messaging.publish(messageName, data, { crossWindow: true });
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;&lt;a id="unsubscribe" name="unsubscribe"&gt;&lt;/a&gt;unsubscribe&lt;/h4&gt;
&lt;p&gt;Unsubcribes a specific message handler by subscription handle or one or multiple subscriptions by namespace&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.messaging.unsubscribe(subscriptionId);
$.telligent.evolution.messaging.unsubscribe(namespace);
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;&lt;a id="suppress" name="suppress"&gt;&lt;/a&gt;suppress&lt;/h4&gt;
&lt;p&gt;Suppresses, but leaves bound, a specific message handler by subscription handle or one or multiple subscriptions by namespace&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.messaging.suppress(subscriptionId);
$.telligent.evolution.messaging.suppress(namespace);
&lt;/code&gt;&lt;/pre&gt;

&lt;h4&gt;&lt;a id="unsuppress" name="unsuppress"&gt;&lt;/a&gt;unsuppress&lt;/h4&gt;
&lt;p&gt;Un-suppresses a specific message handler by subscription handle or one or multiple subscriptions by namespace&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.messaging.unsuppress(subscriptionId);
$.telligent.evolution.messaging.unsuppress(namespace);
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;a id="Automatic_Message_Links" name="Automatic_Message_Links"&gt;&lt;/a&gt;Automatic Message Links&lt;/h3&gt;
&lt;p&gt;Anchors which define the attribute, &lt;code&gt;data-messagename&lt;/code&gt; raise a message named according to the value of the attribute when clicked without the need for explicitly binding. Message links&amp;#39; binding is delegated to support links being added or modified dynamically.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Register a message link on an anchor
&amp;lt;a href=&amp;quot;#&amp;quot; data-messagename=&amp;quot;action.occurred&amp;quot;&amp;gt;My Link&amp;lt;/a&amp;gt;

// handle the message
$.telligent.evolution.messaging.subscribe(&amp;#39;action.occurred&amp;#39;, function(data) {
    // handle the message
    // data.target is the link which raised the message
});
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>