Commit 576efc48 authored by JC Brand's avatar JC Brand

Initial work on breaking converse.js up into components

First component to remove is MUC which was moved to src/converse-muc.js
The components are written as plugins and use converse.js's plugin machinery.

Update the plugin docs somewhat with new insites found while working on the muc
plugin.
parent 02e74ed3
This diff is collapsed.
...@@ -837,6 +837,26 @@ An example plugin ...@@ -837,6 +837,26 @@ An example plugin
// The following line registers your plugin. // The following line registers your plugin.
converse_api.plugins.add('myplugin', { converse_api.plugins.add('myplugin', {
initialize: function () {
// Converse.js's plugin mechanism will call the initialize
// method on any plugin (if it exists) as soon as the plugin has
// been loaded.
// Inside this method, you have access to the protected "inner"
// converse object, from which you can get any configuration
// options that the user might have passed in via
// converse.initialize. These values are stored in the
// "user_settings" attribute.
// Let's assume the user might in a custom setting, like so:
// converse.initialize({
// "initialize_message": "My plugin has been initialized"
// });
//
// Then we can alert that message, like so:
alert(this.converse.user_settings.initialize_message);
},
myFunction: function () { myFunction: function () {
// This is a function which does not override anything in // This is a function which does not override anything in
// converse.js itself, but in which you still have access to // converse.js itself, but in which you still have access to
......
...@@ -17,8 +17,6 @@ require.config({ ...@@ -17,8 +17,6 @@ require.config({
"backbone": "components/backbone/backbone", "backbone": "components/backbone/backbone",
"backbone.browserStorage": "components/backbone.browserStorage/backbone.browserStorage", "backbone.browserStorage": "components/backbone.browserStorage/backbone.browserStorage",
"backbone.overview": "components/backbone.overview/backbone.overview", "backbone.overview": "components/backbone.overview/backbone.overview",
"converse-dependencies": "src/deps-full",
"converse-templates": "src/templates",
"eventemitter": "components/otr/build/dep/eventemitter", "eventemitter": "components/otr/build/dep/eventemitter",
"jquery": "components/jquery/dist/jquery", "jquery": "components/jquery/dist/jquery",
"jquery-private": "src/jquery-private", "jquery-private": "src/jquery-private",
...@@ -45,6 +43,12 @@ require.config({ ...@@ -45,6 +43,12 @@ require.config({
"utils": "src/utils", "utils": "src/utils",
"polyfill": "src/polyfill", "polyfill": "src/polyfill",
// Converse
"converse-core": "src/converse-core",
"converse-muc": "src/converse-muc",
"converse-dependencies": "src/deps-full",
"converse-templates": "src/templates",
// Off-the-record-encryption // Off-the-record-encryption
"bigint": "src/bigint", "bigint": "src/bigint",
"crypto": "src/crypto", "crypto": "src/crypto",
...@@ -195,7 +199,7 @@ require.config({ ...@@ -195,7 +199,7 @@ require.config({
}); });
if (typeof(require) === 'function') { if (typeof(require) === 'function') {
require(["converse"], function(converse) { require(["converse"], function(converse_api) {
window.converse = converse; window.converse = converse_api;
}); });
} }
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment