Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
d95610cb
Commit
d95610cb
authored
Dec 15, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation for events emitted. Updates #48
parent
e729471b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
400 additions
and
46 deletions
+400
-46
docs/doctrees/index.doctree
docs/doctrees/index.doctree
+0
-0
docs/html/_sources/index.txt
docs/html/_sources/index.txt
+117
-0
docs/html/index.html
docs/html/index.html
+165
-45
docs/html/searchindex.js
docs/html/searchindex.js
+1
-1
docs/source/index.rst
docs/source/index.rst
+117
-0
No files found.
docs/doctrees/index.doctree
View file @
d95610cb
No preview for this file type
docs/html/_sources/index.txt
View file @
d95610cb
...
...
@@ -537,6 +537,123 @@ It shows in which order the libraries must be loaded via ``<script>`` tags. Add
your own libraries, making sure that they are loaded in the correct order (e.g.
jQuery plugins must load after jQuery).
======
Events
======
Converse.js emits events to which you can subscribe from your own Javascript.
Concerning events, the following methods are available:
Event Methods
=============
* **on(eventName, callback)**:
Calling the ``on`` method allows you to subscribe to an event.
Every time the event fires, the callback method specified by ``callback`` will be
called.
Parameters:
* ``eventName`` is the event name as a string.
* ``callback`` is the callback method to be called when the event is emitted.
For example::
converse.on('onMessage', function (message) { ... });
* **once(eventName, callback)**:
Calling the ``once`` method allows you to listen to an event
exactly once.
Parameters:
* ``eventName`` is the event name as a string.
* ``callback`` is the callback method to be called when the event is emitted.
For example::
converse.once('onMessage', function (message) { ... });
* **off(eventName, callback)**
To stop listening to an event, you can use the ``off`` method.
Parameters:
* ``eventName`` is the event name as a string.
* ``callback`` refers to the function that is to be no longer executed.
Event Types
===========
Here are the different events that are emitted:
* **onMessage**
``converse.on('onMessage', function (message) { ... });``
Triggered when a message is received.
* **onMessageSend**
``converse.on('onMessageSend', function (message) { ... });``
Triggered when a message will be sent out.
* **onRoster**
``converse.on('onRoster', function (items) { ... });``
Triggered when the roster is updated.
* **onChatBoxFocused**
``converse.on('onChatBoxFocused', function (chatbox) { ... });``
Triggered when the focus has been moved to a chat box.
* **onChatBoxOpened**
``converse.on('onChatBoxOpened', function (chatbox) { ... });``
Triggered when a chat box has been opened.
* **onChatBoxClosed**
``converse.on('onChatBoxClosed', function (chatbox) { ... });``
Triggered when a chat box has been closed.
* **onStatusChanged**
``converse.on('onStatusChanged', function (status) { ... });``
Triggered when own chat status has changed.
* **onStatusMessageChanged**
``converse.on('onStatusMessageChanged', function (message) { ... });``
Triggered when own custom status message has changed.
* **onBuddyStatusChanged**
``converse.on('onBuddyStatusChanged', function (buddy, status) { ... });``
Triggered when a chat buddy's chat status has changed.
* **onBuddyStatusMessageChanged**
``converse.on('onBuddyStatusMessageChanged', function (buddy, message) { ... });``
Triggered when a chat buddy's custom status message has changed.
=============
Configuration
=============
...
...
docs/html/index.html
View file @
d95610cb
This diff is collapsed.
Click to expand it.
docs/html/searchindex.js
View file @
d95610cb
This diff is collapsed.
Click to expand it.
docs/source/index.rst
View file @
d95610cb
...
...
@@ -537,6 +537,123 @@ It shows in which order the libraries must be loaded via ``<script>`` tags. Add
your own libraries, making sure that they are loaded in the correct order (e.g.
jQuery plugins must load after jQuery).
======
Events
======
Converse.js emits events to which you can subscribe from your own Javascript.
Concerning events, the following methods are available:
Event Methods
=============
* **on(eventName, callback)**:
Calling the ``on`` method allows you to subscribe to an event.
Every time the event fires, the callback method specified by ``callback`` will be
called.
Parameters:
* ``eventName`` is the event name as a string.
* ``callback`` is the callback method to be called when the event is emitted.
For example::
converse.on('onMessage', function (message) { ... });
* **once(eventName, callback)**:
Calling the ``once`` method allows you to listen to an event
exactly once.
Parameters:
* ``eventName`` is the event name as a string.
* ``callback`` is the callback method to be called when the event is emitted.
For example::
converse.once('onMessage', function (message) { ... });
* **off(eventName, callback)**
To stop listening to an event, you can use the ``off`` method.
Parameters:
* ``eventName`` is the event name as a string.
* ``callback`` refers to the function that is to be no longer executed.
Event Types
===========
Here are the different events that are emitted:
* **onMessage**
``converse.on('onMessage', function (message) { ... });``
Triggered when a message is received.
* **onMessageSend**
``converse.on('onMessageSend', function (message) { ... });``
Triggered when a message will be sent out.
* **onRoster**
``converse.on('onRoster', function (items) { ... });``
Triggered when the roster is updated.
* **onChatBoxFocused**
``converse.on('onChatBoxFocused', function (chatbox) { ... });``
Triggered when the focus has been moved to a chat box.
* **onChatBoxOpened**
``converse.on('onChatBoxOpened', function (chatbox) { ... });``
Triggered when a chat box has been opened.
* **onChatBoxClosed**
``converse.on('onChatBoxClosed', function (chatbox) { ... });``
Triggered when a chat box has been closed.
* **onStatusChanged**
``converse.on('onStatusChanged', function (status) { ... });``
Triggered when own chat status has changed.
* **onStatusMessageChanged**
``converse.on('onStatusMessageChanged', function (message) { ... });``
Triggered when own custom status message has changed.
* **onBuddyStatusChanged**
``converse.on('onBuddyStatusChanged', function (buddy, status) { ... });``
Triggered when a chat buddy's chat status has changed.
* **onBuddyStatusMessageChanged**
``converse.on('onBuddyStatusMessageChanged', function (buddy, message) { ... });``
Triggered when a chat buddy's custom status message has changed.
=============
Configuration
=============
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment