Google Chrome devtools comes with an extended API provided by so called Command Line Api. API reference can be found here. Access to the API is implemented by wrapping console input with with
statement like this:
with (__commandLineAPI || { __proto__: null }) {
//blah-blah-blah your code goes here
}
Suppose I want to add my own methods to __commandLineAPI
object. For example debugAll
function that takes any object and invoke debug
for all function properties. Is there any way to extend it?
I'm not sure you can modify the __commandLineAPI directly, but a chrome extension could provide extra global functions which you can use.
There's not a lot of info, but see here on the chrome site where they say:
Chrome extensions can inject additional helper methods into the commandline API. For example, the Debug Utils extension (github) offers hooks for breaking on property access, event firings, and method calls.
Also, there's an example they provide on github
That example uses devtools_page
key in manifest.json to specify an HTML page to load for each instance of DevTools open and the chrome.devtools.inspectedWindow API to provide functions globally
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With