Passed
Push — master ( 4e6573...d5fcc5 )
by Michael
02:15
created

script/Menu/MenuItem.js   A

Size

Lines of Code 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 1
rs 10
noi 1
1
/**
2
 * Create a new MenuItem
3
 *
4
 * The constructor needs the following keys:
5
 *
6
 * command: must be command function created by prosemirror-commands or similar
7
 */
8
class MenuItem {
9
    isActive() { // eslint-disable-line class-methods-use-this
10
        return false;
11
    }
12
13
    constructor(options = {}) {
14
        if (typeof options.command !== 'function') {
15
            throw new Error('command is not a function!');
16
        }
17
18
        this.command = options.command;
19
20
        if (!(options.dom instanceof Element)) {
0 ignored issues
show
Bug introduced by
The variable Element seems to be never declared. If this is a global, consider adding a /** global: Element */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
21
            throw new Error('dom must be a DOM node!');
22
        }
23
24
        this.dom = options.dom;
25
26
        if (typeof options.isActive === 'function') {
27
            this.isActive = options.isActive;
28
        }
29
    }
30
}
31
32
exports.MenuItem = MenuItem;
33