Skip to content

Instantly share code, notes, and snippets.

@vdeturckheim
Last active January 21, 2021 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdeturckheim/1b2ab6d813657b3e6d1b21b647285e79 to your computer and use it in GitHub Desktop.
Save vdeturckheim/1b2ab6d813657b3e6d1b21b647285e79 to your computer and use it in GitHub Desktop.
await client.Runtime.evaluate({
expression:"process.patchListeners = require(`./toInject.js`).patchListeners",
includeCommandLineAPI: true,
returnByValue: false
});
// in the injected function, the value for `this` will be the instance of the server
await client.Runtime.callFunctionOn({
objectId: serverInstance,
functionDeclaration: 'function() { process.patchListeners(this) }',
returnByValue: true
});
await client.Runtime.evaluate({
expression:"delete process.patchListeners",
includeCommandLineAPI: true,
returnByValue: false
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment