Coding style
For lack of a better word/phrase, I'm calling all changes coding style. I'm targeting readability through naming and syntax.
This commit is contained in:
committed by
hristoterezov
parent
3e055c1201
commit
e9dc9c47a9
+16
-17
@@ -37,9 +37,7 @@ function initCommands() {
|
||||
'email': APP.conference.changeLocalEmail,
|
||||
'avatar-url': APP.conference.changeLocalAvatarUrl
|
||||
};
|
||||
transport.on('event', event => {
|
||||
const { name, data } = event;
|
||||
|
||||
transport.on('event', ({ data, name }) => {
|
||||
if (name && commands[name]) {
|
||||
commands[name](...data);
|
||||
|
||||
@@ -101,15 +99,18 @@ class API {
|
||||
* module.
|
||||
* @returns {void}
|
||||
*/
|
||||
init(options = {}) {
|
||||
if (!shouldBeEnabled() && !options.forceEnable) {
|
||||
init({ forceEnable } = {}) {
|
||||
if (!shouldBeEnabled() && !forceEnable) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Current status (enabled/disabled) of API.
|
||||
*
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.enabled = true;
|
||||
this._enabled = true;
|
||||
|
||||
APP.conference.addListener(
|
||||
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
|
||||
@@ -126,10 +127,10 @@ class API {
|
||||
* @returns {void}
|
||||
*/
|
||||
_sendEvent(name, data = {}) {
|
||||
if (this.enabled) {
|
||||
if (this._enabled) {
|
||||
transport.sendEvent({
|
||||
name,
|
||||
data
|
||||
data,
|
||||
name
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -151,17 +152,15 @@ class API {
|
||||
* @param {Object} options - Object with the message properties.
|
||||
* @returns {void}
|
||||
*/
|
||||
notifyReceivedChatMessage(options = {}) {
|
||||
const { id, nick, body, ts } = options;
|
||||
|
||||
notifyReceivedChatMessage({ body, id, nick, ts } = {}) {
|
||||
if (APP.conference.isLocalId(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._sendEvent('incoming-message', {
|
||||
from: id,
|
||||
nick,
|
||||
message: body,
|
||||
nick,
|
||||
stamp: ts
|
||||
});
|
||||
}
|
||||
@@ -198,8 +197,8 @@ class API {
|
||||
*/
|
||||
notifyDisplayNameChanged(id, displayname) {
|
||||
this._sendEvent('display-name-change', {
|
||||
id,
|
||||
displayname
|
||||
displayname,
|
||||
id
|
||||
});
|
||||
}
|
||||
|
||||
@@ -241,8 +240,8 @@ class API {
|
||||
* @returns {void}
|
||||
*/
|
||||
dispose() {
|
||||
if (this.enabled) {
|
||||
this.enabled = false;
|
||||
if (this._enabled) {
|
||||
this._enabled = false;
|
||||
APP.conference.removeListener(
|
||||
JitsiMeetConferenceEvents.DESKTOP_SHARING_ENABLED_CHANGED,
|
||||
onDesktopSharingEnabledChanged);
|
||||
|
||||
@@ -3,5 +3,4 @@ declare var getConfigParamsFromUrl: Function;
|
||||
/**
|
||||
* JitsiMeetExternalAPI id - unique for a webpage.
|
||||
*/
|
||||
export const API_ID
|
||||
= getConfigParamsFromUrl().jitsi_meet_external_api_id;
|
||||
export const API_ID = getConfigParamsFromUrl().jitsi_meet_external_api_id;
|
||||
|
||||
Vendored
+6
-10
@@ -81,8 +81,8 @@ function configToURLParamsArray(config = {}) {
|
||||
|
||||
for (const key in config) { // eslint-disable-line guard-for-in
|
||||
try {
|
||||
params.push(`${key}=${
|
||||
encodeURIComponent(JSON.stringify(config[key]))}`);
|
||||
params.push(
|
||||
`${key}=${encodeURIComponent(JSON.stringify(config[key]))}`);
|
||||
} catch (e) {
|
||||
console.warn(`Error encoding ${key}: ${e}`);
|
||||
}
|
||||
@@ -233,14 +233,10 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||
*/
|
||||
_setupListeners() {
|
||||
|
||||
this._transport.on('event', event => {
|
||||
const { name, data } = event;
|
||||
|
||||
this._transport.on('event', ({ data, name }) => {
|
||||
if (name === 'participant-joined') {
|
||||
changeParticipantNumber(this, 1);
|
||||
}
|
||||
|
||||
if (name === 'participant-left') {
|
||||
} else if (name === 'participant-left') {
|
||||
changeParticipantNumber(this, -1);
|
||||
}
|
||||
|
||||
@@ -364,8 +360,8 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
this._transport.sendEvent({
|
||||
name: commands[name],
|
||||
data: args
|
||||
data: args,
|
||||
name: commands[name]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user