Commit 11c1b016 authored by JC Brand's avatar JC Brand

Add converse-headless.js dist file and recipes

updates #1352
parent d919e812
...@@ -196,6 +196,8 @@ logo/conversejs-filled%.png:: logo/conversejs-filled.svg ...@@ -196,6 +196,8 @@ logo/conversejs-filled%.png:: logo/conversejs-filled.svg
BUILDS = dist/converse.js \ BUILDS = dist/converse.js \
dist/converse.min.js \ dist/converse.min.js \
dist/converse-headless.js \ dist/converse-headless.js \
src/headless/dist/converse-headless.js \
src/headless/dist/converse-headless.min.js \
dist/converse-headless.min.js \ dist/converse-headless.min.js \
dist/converse-no-dependencies.min.js \ dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js \ dist/converse-no-dependencies.js \
...@@ -207,8 +209,12 @@ dist/converse.min.js: src webpack.config.js stamp-npm @converse/headless ...@@ -207,8 +209,12 @@ dist/converse.min.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=production $(NPX) webpack --mode=production
dist/converse-headless.js: src webpack.config.js stamp-npm @converse/headless dist/converse-headless.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=development --type=headless $(NPX) webpack --mode=development --type=headless
src/headless/dist/converse-headless.js: dist/converse-headless.js
cp dist/converse-headless.js src/headless/dist/converse-headless.js
dist/converse-headless.min.js: src webpack.config.js stamp-npm @converse/headless dist/converse-headless.min.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=production --type=headless $(NPX) webpack --mode=production --type=headless
src/headless/dist/converse-headless.min.js: dist/converse-headless.min.js
cp dist/converse-headless.min.js src/headless/dist/converse-headless.min.js
dist/converse-no-dependencies.js: src webpack.config.js stamp-npm @converse/headless dist/converse-no-dependencies.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=development --type=nodeps $(NPX) webpack --mode=development --type=nodeps
dist/converse-no-dependencies.min.js: src webpack.config.js stamp-npm @converse/headless dist/converse-no-dependencies.min.js: src webpack.config.js stamp-npm @converse/headless
...@@ -229,11 +235,14 @@ build:: dev css $(BUILDS) ...@@ -229,11 +235,14 @@ build:: dev css $(BUILDS)
.PHONY: eslint .PHONY: eslint
eslint: stamp-npm eslint: stamp-npm
$(ESLINT) src/ $(ESLINT) src/*.js
$(ESLINT) src/utils/*.js
$(ESLINT) src/headless/*.js
$(ESLINT) src/headless/utils/*.js
$(ESLINT) spec/ $(ESLINT) spec/
.PHONY: check .PHONY: check
check: dist/converse.js eslint check: eslint dist/converse.js
LOG_CR_VERBOSITY=INFO $(CHROMIUM) --disable-gpu --no-sandbox http://localhost:$(HTTPSERVE_PORT)/tests/index.html LOG_CR_VERBOSITY=INFO $(CHROMIUM) --disable-gpu --no-sandbox http://localhost:$(HTTPSERVE_PORT)/tests/index.html
######################################################################## ########################################################################
......
This diff is collapsed.
...@@ -3,8 +3,13 @@ ...@@ -3,8 +3,13 @@
// //
// Copyright (c) 2013-2019, the Converse.js developers // Copyright (c) 2013-2019, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2) // Licensed under the Mozilla Public License (MPLv2)
//
// XEP-0045 Multi-User Chat Views
import "converse-modal"; import "converse-modal";
import "backbone.overview/backbone.orderedlistview";
import "backbone.overview/backbone.overview";
import "backbone.vdomview";
import Awesomplete from "awesomplete"; import Awesomplete from "awesomplete";
import _FormData from "formdata-polyfill"; import _FormData from "formdata-polyfill";
import converse from "@converse/headless/converse-core"; import converse from "@converse/headless/converse-core";
......
...@@ -439,27 +439,30 @@ function unregisterGlobalEventHandlers () { ...@@ -439,27 +439,30 @@ function unregisterGlobalEventHandlers () {
} }
function cleanup () { function cleanup () {
// Looks like _converse.initialized was called again without logging // Looks like _converse.initialized was called again without logging
// out or disconnecting in the previous session. // out or disconnecting in the previous session.
// This happens in tests. We therefore first clean up. // This happens in tests. We therefore first clean up.
Backbone.history.stop(); Backbone.history.stop();
_converse.chatboxviews.closeAllChatBoxes(); if (_converse.chatboxviews) {
unregisterGlobalEventHandlers(); _converse.chatboxviews.closeAllChatBoxes();
window.localStorage.clear(); }
window.sessionStorage.clear(); unregisterGlobalEventHandlers();
if (_converse.bookmarks) { window.localStorage.clear();
_converse.bookmarks.reset(); window.sessionStorage.clear();
} if (_converse.bookmarks) {
delete _converse.controlboxtoggle; _converse.bookmarks.reset();
delete _converse.chatboxviews; }
delete _converse.controlboxtoggle;
_converse.connection.reset(); if (_converse.chatboxviews) {
_converse.tearDown(); delete _converse.chatboxviews;
_converse.stopListening(); }
_converse.off(); _converse.connection.reset();
_converse.tearDown();
delete _converse.config; _converse.stopListening();
initClientConfig(); _converse.off();
delete _converse.config;
initClientConfig();
} }
...@@ -1195,9 +1198,6 @@ _converse.initialize = async function (settings, callback) { ...@@ -1195,9 +1198,6 @@ _converse.initialize = async function (settings, callback) {
}; };
this.tearDown = function () { this.tearDown = function () {
/* Remove those views which are only allowed with a valid
* connection.
*/
_converse.emit('beforeTearDown'); _converse.emit('beforeTearDown');
if (!_.isUndefined(_converse.session)) { if (!_.isUndefined(_converse.session)) {
_converse.session.destroy(); _converse.session.destroy();
......
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
// //
// Copyright (c) 2013-2019, the Converse.js developers // Copyright (c) 2013-2019, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2) // Licensed under the Mozilla Public License (MPLv2)
//
// XEP-0045 Multi-User Chat
import "./converse-disco"; import "./converse-disco";
import "./utils/emoji"; import "./utils/emoji";
import "./utils/muc"; import "./utils/muc";
import "backbone.overview/backbone.orderedlistview";
import "backbone.overview/backbone.overview";
import "backbone.vdomview";
import converse from "./converse-core"; import converse from "./converse-core";
import u from "./utils/form"; import u from "./utils/form";
...@@ -1314,11 +1313,15 @@ converse.plugins.add('converse-muc', { ...@@ -1314,11 +1313,15 @@ converse.plugins.add('converse-muc', {
} }
} }
if (result === true) { if (result === true) {
const chatroom = _converse.openChatRoom( const chatroom = _converse.openChatRoom(room_jid, {'password': x_el.getAttribute('password') });
room_jid, {'password': x_el.getAttribute('password') });
if (chatroom.get('connection_status') === converse.ROOMSTATUS.DISCONNECTED) { if (chatroom.get('connection_status') === converse.ROOMSTATUS.DISCONNECTED) {
_converse.chatboxviews.get(room_jid).join(); // XXX: Leaky abstraction from views here
if (_converse.chatboxviews) {
_converse.chatboxviews.get(room_jid).join();
} else {
_converse.chatboxes.get(room_jid).join();
}
} }
} }
}; };
...@@ -1445,8 +1448,7 @@ converse.plugins.add('converse-muc', { ...@@ -1445,8 +1448,7 @@ converse.plugins.add('converse-muc', {
* Creates a new MUC chatroom (aka groupchat) * Creates a new MUC chatroom (aka groupchat)
* *
* Similar to {@link _converse.api.rooms.open}, but creates * Similar to {@link _converse.api.rooms.open}, but creates
* the chatroom in the background (i.e. doesn't cause a * the chatroom in the background (i.e. doesn't cause a view to open).
* view to open).
* *
* @method _converse.api.rooms.create * @method _converse.api.rooms.create
* @param {(string[]|string)} jid|jids The JID or array of * @param {(string[]|string)} jid|jids The JID or array of
......
This diff is collapsed.
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
"version": "4.1.2", "version": "4.1.2",
"description": "Converse.js Headless build", "description": "Converse.js Headless build",
"author": "cmrd Senya <senya@riseup.net>", "author": "cmrd Senya <senya@riseup.net>",
"homepage": "https://github.com/conversejs/converse.js", "homepage": "https://conversejs.org",
"license": "MPL-2.0", "license": "MPL-2.0",
"main": "converse-core.js", "main": "dist/converse-headless.js",
"files": [ "files": [
"**/*.js", "**/*.js",
"templates/*" "templates/*"
......
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