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
38e6012f
Commit
38e6012f
authored
Sep 04, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mention the Yeoman plugin generator
parent
061832df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
docs/source/plugin_development.rst
docs/source/plugin_development.rst
+27
-4
No files found.
docs/source/plugin_development.rst
View file @
38e6012f
...
@@ -30,8 +30,8 @@ To more deeply understand how this plugin architecture works, please read the
...
@@ -30,8 +30,8 @@ To more deeply understand how this plugin architecture works, please read the
and to understand its inner workins, please refer to the `annotated source code
and to understand its inner workins, please refer to the `annotated source code
<https://jcbrand.github.io/pluggable.js/docs/pluggable.html>`_.
<https://jcbrand.github.io/pluggable.js/docs/pluggable.html>`_.
Playing with a Converse.js
plugin in JSFiddle
Trying out a
plugin in JSFiddle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Because Converse.js consists only of JavaScript, HTML and CSS (with no backend
Because Converse.js consists only of JavaScript, HTML and CSS (with no backend
code required like PHP, Python or Ruby) it runs fine in JSFiddle.
code required like PHP, Python or Ruby) it runs fine in JSFiddle.
...
@@ -41,10 +41,34 @@ initialized and also when a chat message gets rendered:
...
@@ -41,10 +41,34 @@ initialized and also when a chat message gets rendered:
https://jsfiddle.net/4drfaok0/15/
https://jsfiddle.net/4drfaok0/15/
Generating a plugin with Yeoman
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The rest of this document explains how to write a plugin for Converse.js, and
ends with a documented example of a plugin.
You can use a `Yeoman <http://yeoman.io/>`_ code generator, called
`generator-conversejs <https://github.com/jcbrand/generator-conversejs>`_ to
generate plugin scaffolding code, which you can use as a starting point and
basis for writing your plugin.
Please refer to the `generator-conversejs <https://github.com/jcbrand/generator-conversejs>`_
README for information on how to use it.
Registering a plugin
Registering a plugin
--------------------
--------------------
You register a converse.js plugin as follows:
Plugins need to be registered (and whitelisted) before they can be loaded and
initialized.
You register a converse.js plugin by calling ``converse.plugins.add``.
The plugin itself is a JavaScript object which usually has at least an
``initialize`` method, which gets called at the end of the
``converse.initialize`` method which is the top-level method that gets called
by the website to configure and initialize Converse.js itself.
Here's an example code snippet:
.. code-block:: javascript
.. code-block:: javascript
...
@@ -64,7 +88,6 @@ You register a converse.js plugin as follows:
...
@@ -64,7 +88,6 @@ You register a converse.js plugin as follows:
`converse.initialize` is called. Otherwise the plugin will never get
`converse.initialize` is called. Otherwise the plugin will never get
registered and never get called.
registered and never get called.
Whitelisting of plugins
Whitelisting of plugins
-----------------------
-----------------------
...
...
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