Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ui/ve.ui.ActionFactory.js

raw symbols SCIP
1 /*!
2 * VisualEditor UserInterface ActionFactory class.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * Action factory.
9 *
10 * @class
11 * @extends OO.Factory
12 * @constructor
13 */
14 ve.ui.ActionFactory = function VeUiActionFactory() {
15 // Parent constructor
16 OO.Factory.call( this );
17 };
18
19 /* Inheritance */
20
21 OO.inheritClass( ve.ui.ActionFactory, OO.Factory );
22
23 /* Methods */
24
25 /**
26 * Check if an action supports a method.
27 *
28 * @param {string} action Name of action
29 * @param {string} method Name of method
30 * @return {boolean} The action supports the method
31 */
32 ve.ui.ActionFactory.prototype.doesActionSupportMethod = function ( action, method ) {
33 if ( Object.prototype.hasOwnProperty.call( this.registry, action ) ) {
34 return this.registry[ action ].static.methods.indexOf( method ) !== -1;
35 }
36 throw new Error( 'Unknown action: ' + action );
37 };
38
39 /* Initialization */
40
41 ve.ui.actionFactory = new ve.ui.ActionFactory();