Various JSDoc related fixes and improvements

Using the `@method` directive on a `@class` means that the method
doesn't appear.
This commit is contained in:
JC Brand 2020-04-23 10:04:14 +02:00
parent b44c0c266c
commit c6f8ef0c46
3 changed files with 107 additions and 109 deletions

View File

@ -55,8 +55,7 @@ function absoluteOffsetLeft(el) {
/**
* Adds the ability to navigate the DOM with the arrow keys
* @class
* @namespace DOMNavigator
* @class DOMNavigator
*/
class DOMNavigator {
/**
@ -162,7 +161,6 @@ class DOMNavigator {
/**
* Initialize the navigator.
* @method DOMNavigator#init
*/
init () {
this.selected = null;
@ -180,7 +178,6 @@ class DOMNavigator {
/**
* Enable this navigator.
* @method DOMNavigator#enable
*/
enable () {
this.getElements();
@ -191,7 +188,6 @@ class DOMNavigator {
/**
* Disable this navigator.
* @method DOMNavigator#disable
*/
disable () {
if (this.keydownHandler) {
@ -204,7 +200,6 @@ class DOMNavigator {
/**
* Destroy this navigator removing any event registered and any other data.
* @method DOMNavigator#destroy
*/
destroy () {
this.disable();
@ -214,7 +209,6 @@ class DOMNavigator {
}
/**
* @method DOMNavigator#getNextElement
* @param {'down'|'right'|'left'|'up'} direction
* @returns { HTMLElement }
*/
@ -266,7 +260,6 @@ class DOMNavigator {
/**
* Select the given element.
* @method DOMNavigator#select
* @param { Element } el The DOM element to select.
* @param { string } [direction] The direction.
*/
@ -287,7 +280,6 @@ class DOMNavigator {
/**
* Remove the current selection
* @method DOMNavigator#unselect
*/
unselect () {
if (this.selected) {
@ -298,7 +290,6 @@ class DOMNavigator {
/**
* Scroll the container to an element.
* @method DOMNavigator#scrollTo
* @param { HTMLElement } el The destination element.
* @param { String } direction The direction of the current navigation.
* @return void.
@ -345,7 +336,6 @@ class DOMNavigator {
/**
* Indicate if an element is in the container viewport.
* @method DOMNavigator#inScrollContainerViewport
* @param { HTMLElement } el The element to check.
* @return { Boolean } true if the given element is in the container viewport, otherwise false.
*/
@ -372,7 +362,6 @@ class DOMNavigator {
/**
* Find and store the navigable elements
* @method DOMNavigator#getElements
*/
getElements (direction) {
const selector = this.options.getSelector ? this.options.getSelector(direction) : this.options.selector;
@ -384,7 +373,6 @@ class DOMNavigator {
/**
* Return an array of navigable elements after an offset.
* @method DOMNavigator#elementsAfter
* @param { number } left The left offset.
* @param { number } top The top offset.
* @return { Array } An array of elements.
@ -395,7 +383,6 @@ class DOMNavigator {
/**
* Return an array of navigable elements before an offset.
* @method DOMNavigator#elementsBefore
* @param { number } left The left offset.
* @param { number } top The top offset.
* @return { Array } An array of elements.
@ -406,7 +393,6 @@ class DOMNavigator {
/**
* Handle the key down event.
* @method DOMNavigator#handleKeydown
* @param { Event } event The event object.
*/
handleKeydown (ev) {

View File

@ -6,11 +6,13 @@
*/
import "./converse-disco";
import "./converse-rsm";
import { api } from "@converse/headless/converse-core";
import { intersection, pick } from 'lodash'
import { converse } from "./converse-core";
import log from "./log";
import sizzle from "sizzle";
let _converse;
const { Strophe, $iq, dayjs } = converse.env;
const u = converse.env.utils;
@ -18,24 +20,10 @@ const u = converse.env.utils;
const MAM_ATTRIBUTES = ['with', 'start', 'end'];
converse.plugins.add('converse-mam', {
dependencies: ['converse-rsm', 'converse-disco', 'converse-muc'],
initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by Converse.js's plugin machinery.
/**
* The MUC utils object. Contains utility functions related to multi-user chat.
* @mixin MAMEnabledChat
*/
const { _converse } = this;
const { api } = _converse;
api.settings.update({
archived_messages_page_size: '50',
message_archiving: undefined, // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs)
message_archiving_timeout: 20000, // Time (in milliseconds) to wait before aborting MAM request
});
const MAMEnabledChat = {
/**
* Fetches messages that might have been archived *after*
@ -98,6 +86,11 @@ converse.plugins.add('converse-mam', {
}, options);
const result = await api.archive.query(query);
/**
* *Hook* which allows plugins to inspect and potentially modify the result of a MAM query
* from {@link MAMEnabledChat.fetchArchivedMessages}.
* @event _converse#MAMResult
*/
api.hook('MAMResult', this, { result, query });
for (const message of result.messages) {
@ -127,6 +120,25 @@ converse.plugins.add('converse-mam', {
}
}
}
converse.plugins.add('converse-mam', {
dependencies: ['converse-rsm', 'converse-disco', 'converse-muc'],
initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by Converse.js's plugin machinery.
*/
_converse = this._converse;
api.settings.update({
archived_messages_page_size: '50',
message_archiving: undefined, // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs)
message_archiving_timeout: 20000, // Time (in milliseconds) to wait before aborting MAM request
});
Object.assign(_converse.ChatBox.prototype, MAMEnabledChat);

View File

@ -11,7 +11,7 @@ const { Strophe, sizzle } = converse.env;
/**
* The MUC utils object. Contains utility functions related to multi-user chat.
* @namespace stanza_utils
* @namespace muc_utils
*/
const muc_utils = {
/**