Completed
Branch master (28f58d)
by Michael
02:42
created

script/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
    constructor(options = {}) {
10
        if (typeof options.command !== 'function') {
11
            throw new Error('command is not a function!');
12
        }
13
14
        this.command = options.command;
15
16
        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...
17
            throw new Error('dom must be a DOM node!');
18
        }
19
20
        this.dom = options.dom;
21
    }
22
}
23
24
exports.MenuItem = MenuItem;
25