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