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

6728
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

12
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",
@ -45,6 +43,12 @@ require.config({
"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",
"crypto": "src/crypto",
@ -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