Skip to content

Instantly share code, notes, and snippets.

@SergeyPirogov
Created February 6, 2020 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SergeyPirogov/db9d2adafb14a7e8c4b4c1d16f29c3ff to your computer and use it in GitHub Desktop.
Save SergeyPirogov/db9d2adafb14a7e8c4b4c1d16f29c3ff to your computer and use it in GitHub Desktop.
const sendCommand = (target, method, params) =>
new Promise((resolve, reject) => {
chrome.debugger.sendCommand(target, method, params, result => {
if (chrome.runtime.lastError) {
reject(chrome.runtime.lastError);
} else {
resolve(result);
console.log(method, result);
}
});
}).catch(err => {
console.log(method, err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment