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.
This commit is contained in:
JC Brand 2016-02-16 07:46:47 +00:00
parent 02e74ed377
commit 576efc4815
5 changed files with 6891 additions and 6724 deletions

6734
converse.js Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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

14
main.js
View File

@ -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;
});
}

5692
src/converse-core.js Executable file

File diff suppressed because it is too large Load Diff

1155
src/converse-muc.js Normal file

File diff suppressed because it is too large Load Diff