mirror of
https://github.com/appium/appium.git
synced 2026-02-21 18:59:08 -06:00
37 lines
927 B
JavaScript
37 lines
927 B
JavaScript
import {logger} from '@appium/support';
|
|
|
|
/**
|
|
* @implements {Plugin}
|
|
*/
|
|
class BasePlugin {
|
|
/**
|
|
* Subclasses should use type `import('@appium/types').MethodMap<SubclassName>`.
|
|
*
|
|
* This will verify that the commands in the `newMethodMap` property are
|
|
* valid. It is impossible to use a generic type param here; the type of this should really
|
|
* be something like `MethodMap<T extends BasePlugin>` but that isn't a thing TS does.
|
|
*/
|
|
static newMethodMap = /** @type {const} */ ({
|
|
'/session/:sessionId/plugin': {
|
|
GET: {command: 'getPlugin'},
|
|
},
|
|
});
|
|
|
|
/**
|
|
* @param {string} name
|
|
* @param {Record<string,unknown>} [cliArgs]
|
|
*/
|
|
constructor(name, cliArgs = {}) {
|
|
this.name = name;
|
|
this.cliArgs = cliArgs;
|
|
this.logger = logger.getLogger(`Plugin [${name}]`);
|
|
}
|
|
}
|
|
|
|
export default BasePlugin;
|
|
export {BasePlugin};
|
|
|
|
/**
|
|
* @typedef {import('@appium/types').Plugin} Plugin
|
|
*/
|