Refined events emitting docs.

This commit is contained in:
JC Brand 2013-12-16 15:27:33 +02:00
parent cdc350f592
commit 603087c34b
5 changed files with 44 additions and 18 deletions

Binary file not shown.

View File

@ -562,7 +562,7 @@ Event Methods
For example::
converse.on('onMessage', function (message) { ... });
converse.on('onMessage', function (messageXML) { ... });
* **once(eventName, callback)**:
@ -576,7 +576,7 @@ Event Methods
For example::
converse.once('onMessage', function (message) { ... });
converse.once('onMessage', function (messageXML) { ... });
* **off(eventName, callback)**
@ -593,15 +593,28 @@ Event Types
Here are the different events that are emitted:
* **onInitialized**
``converse.on('onInitialized', function () { ... });``
Triggered once converse.js has been initialized.
* **onReady**
Triggered after a connection has been established and converse.js has
got all its ducks in a row.
``converse.on('onReady', function () { ... });``
* **onMessage**
``converse.on('onMessage', function (message) { ... });``
``converse.on('onMessage', function (messageXML) { ... });``
Triggered when a message is received.
* **onMessageSend**
``converse.on('onMessageSend', function (message) { ... });``
``converse.on('onMessageSend', function (messageText) { ... });``
Triggered when a message will be sent out.
@ -649,7 +662,7 @@ Here are the different events that are emitted:
* **onBuddyStatusMessageChanged**
``converse.on('onBuddyStatusMessageChanged', function (buddy, message) { ... });``
``converse.on('onBuddyStatusMessageChanged', function (buddy, messageText) { ... });``
Triggered when a chat buddy's custom status message has changed.

View File

@ -549,7 +549,7 @@ called.</p>
<li><tt class="docutils literal"><span class="pre">callback</span></tt> is the callback method to be called when the event is emitted.</li>
</ul>
<p>For example:</p>
<div class="highlight-python"><pre>converse.on('onMessage', function (message) { ... });</pre>
<div class="highlight-python"><pre>converse.on('onMessage', function (messageXML) { ... });</pre>
</div>
</div></blockquote>
</li>
@ -563,7 +563,7 @@ exactly once.</p>
<li><tt class="docutils literal"><span class="pre">callback</span></tt> is the callback method to be called when the event is emitted.</li>
</ul>
<p>For example:</p>
<div class="highlight-python"><pre>converse.once('onMessage', function (message) { ... });</pre>
<div class="highlight-python"><pre>converse.once('onMessage', function (messageXML) { ... });</pre>
</div>
</div></blockquote>
</li>
@ -583,15 +583,28 @@ exactly once.</p>
<h2><a class="toc-backref" href="#id28">Event Types</a><a class="headerlink" href="#event-types" title="Permalink to this headline"></a></h2>
<p>Here are the different events that are emitted:</p>
<ul>
<li><p class="first"><strong>onInitialized</strong></p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onInitialized',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<p>Triggered once converse.js has been initialized.</p>
</div></blockquote>
</li>
<li><p class="first"><strong>onReady</strong></p>
<blockquote>
<div><p>Triggered after a connection has been established and converse.js has
got all its ducks in a row.</p>
<p><tt class="docutils literal"><span class="pre">converse.on('onReady',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
</div></blockquote>
</li>
<li><p class="first"><strong>onMessage</strong></p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onMessage',</span> <span class="pre">function</span> <span class="pre">(message)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onMessage',</span> <span class="pre">function</span> <span class="pre">(messageXML)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<p>Triggered when a message is received.</p>
</div></blockquote>
</li>
<li><p class="first"><strong>onMessageSend</strong></p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onMessageSend',</span> <span class="pre">function</span> <span class="pre">(message)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onMessageSend',</span> <span class="pre">function</span> <span class="pre">(messageText)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<p>Triggered when a message will be sent out.</p>
</div></blockquote>
</li>
@ -639,7 +652,7 @@ exactly once.</p>
</li>
<li><p class="first"><strong>onBuddyStatusMessageChanged</strong></p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onBuddyStatusMessageChanged',</span> <span class="pre">function</span> <span class="pre">(buddy,</span> <span class="pre">message)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<div><p><tt class="docutils literal"><span class="pre">converse.on('onBuddyStatusMessageChanged',</span> <span class="pre">function</span> <span class="pre">(buddy,</span> <span class="pre">messageText)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
<p>Triggered when a chat buddy&#8217;s custom status message has changed.</p>
</div></blockquote>
</li>

File diff suppressed because one or more lines are too long

View File

@ -562,7 +562,7 @@ Event Methods
For example::
converse.on('onMessage', function (message) { ... });
converse.on('onMessage', function (messageXML) { ... });
* **once(eventName, callback)**:
@ -576,7 +576,7 @@ Event Methods
For example::
converse.once('onMessage', function (message) { ... });
converse.once('onMessage', function (messageXML) { ... });
* **off(eventName, callback)**
@ -595,7 +595,7 @@ Here are the different events that are emitted:
* **onInitialized**
``converse.on('onMessage', function () { ... });``
``converse.on('onInitialized', function () { ... });``
Triggered once converse.js has been initialized.
@ -604,17 +604,17 @@ Here are the different events that are emitted:
Triggered after a connection has been established and converse.js has
got all its ducks in a row.
``converse.on('onReady', function (message) { ... });``
``converse.on('onReady', function () { ... });``
* **onMessage**
``converse.on('onMessage', function (message) { ... });``
``converse.on('onMessage', function (messageXML) { ... });``
Triggered when a message is received.
* **onMessageSend**
``converse.on('onMessageSend', function (message) { ... });``
``converse.on('onMessageSend', function (messageText) { ... });``
Triggered when a message will be sent out.
@ -662,7 +662,7 @@ Here are the different events that are emitted:
* **onBuddyStatusMessageChanged**
``converse.on('onBuddyStatusMessageChanged', function (buddy, message) { ... });``
``converse.on('onBuddyStatusMessageChanged', function (buddy, messageText) { ... });``
Triggered when a chat buddy's custom status message has changed.