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
// The following line registers your plugin.
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 () {
// This is a function which does not override anything in
// converse.js itself, but in which you still have access to
......
......@@ -17,8 +17,6 @@ require.config({
"backbone": "components/backbone/backbone",
"backbone.browserStorage": "components/backbone.browserStorage/backbone.browserStorage",
"backbone.overview": "components/backbone.overview/backbone.overview",
"converse-dependencies": "src/deps-full",
"converse-templates": "src/templates",
"eventemitter": "components/otr/build/dep/eventemitter",
"jquery": "components/jquery/dist/jquery",
"jquery-private": "src/jquery-private",
......@@ -44,6 +42,12 @@ require.config({
"underscore": "components/underscore/underscore",
"utils": "src/utils",
"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
"bigint": "src/bigint",
......@@ -57,7 +61,7 @@ require.config({
"crypto.md5": "components/crypto-js-evanvosberg/src/md5",
"crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr",
"crypto.pad-nopadding": "components/otr/vendor/cryptojs/pad-nopadding",
"crypto.sha1": "components/otr/vendor/cryptojs/sha1",
"crypto.sha1": "components/otr/vendor/cryptojs/sha1",
"crypto.sha256": "components/otr/vendor/cryptojs/sha256",
"salsa20": "components/otr/build/dep/salsa20",
"otr": "src/otr",
......@@ -195,7 +199,7 @@ require.config({
});
if (typeof(require) === 'function') {
require(["converse"], function(converse) {
window.converse = converse;
require(["converse"], function(converse_api) {
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