MCPcopy
hub / github.com/berstend/puppeteer-extra / use

Method use

packages/puppeteer-extra/src/index.ts:81–103  ·  view source on GitHub ↗

* The **main interface** to register `puppeteer-extra` plugins. * * @example * puppeteer.use(plugin1).use(plugin2) * * @see [PuppeteerExtraPlugin] * * @return The same `PuppeteerExtra` instance (for optional chaining)

(plugin: PuppeteerExtraPlugin)

Source from the content-addressed store, hash-verified

79 * @return The same `PuppeteerExtra` instance (for optional chaining)
80 */
81 use(plugin: PuppeteerExtraPlugin): this {
82 if (typeof plugin !== 'object' || !plugin._isPuppeteerExtraPlugin) {
83 console.error(
84 `Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`,
85 plugin
86 )
87 return this
88 }
89 if (!plugin.name) {
90 console.error(
91 `Warning: Plugin with no name registering, ignoring.`,
92 plugin
93 )
94 return this
95 }
96 if (plugin.requirements.has('dataFromPlugins')) {
97 plugin.getDataFromPlugins = this.getPluginData.bind(this)
98 }
99 plugin._register(Object.getPrototypeOf(plugin))
100 this._plugins.push(plugin)
101 debug('plugin registered', plugin.name)
102 return this
103 }
104
105 /**
106 * To stay backwards compatible with puppeteer's (and our) default export after adding `addExtra`

Callers 15

index.test.tsFile · 0.45
connect.jsFile · 0.45
options.jsFile · 0.45
events.jsFile · 0.45
plugin-support.jsFile · 0.45
example.jsFile · 0.45
index.test.tsFile · 0.45
getBrowserFunction · 0.45
solve.test.tsFile · 0.45
mainFunction · 0.45

Calls 1

debugFunction · 0.85

Tested by 2

getBrowserFunction · 0.36
_testUAHintFunction · 0.36