-
-
Save Xotabu4/b7c081cb4e5d1625fce211950755e9b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sendCommand = (target, method, params) => { | |
return 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); | |
}); | |
} | |
const result = await sendCommand('foo', 'bar', {params: true}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment