addInitScript
Callback to emit data from the browser back to the Node.js environment. In order to receive the
data returned by the callback function you have to listen to the data
event, e.g.
const script = await browser.addInitScript((emit) => {
emit('hello')
})
script.on('data', (data) => {
console.log(data) // prints: hello
})
Usage
browser.addInitScript(data)
Parameters
Name | Type | Details |
---|---|---|
data | any | The data to emit. |