mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add new chrome.devtools.inspectedWindow.eval overload
Additional Overload accepts the new optional options parameter. fixes https://github.com/DefinitelyTyped/DefinitelyTyped/issues/23597
This commit is contained in:
parent
841d5c17df
commit
4c8fb4edcb
20
types/chrome/index.d.ts
vendored
20
types/chrome/index.d.ts
vendored
@ -1678,6 +1678,17 @@ declare namespace chrome.devtools.inspectedWindow {
|
||||
* Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression.
|
||||
*/
|
||||
export function eval<T>(expression: string, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void;
|
||||
/**
|
||||
* Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object.
|
||||
* @param expression An expression to evaluate.
|
||||
* @param options The options parameter can contain one or more options.
|
||||
* @param callback A function called when evaluation completes.
|
||||
* If you specify the callback parameter, it should be a function that looks like this:
|
||||
* function(object result, object exceptionInfo) {...};
|
||||
* Parameter result: The result of evaluation.
|
||||
* Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression.
|
||||
*/
|
||||
export function eval<T>(expression: string, options: EvalOptions, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void;
|
||||
/**
|
||||
* Retrieves the list of resources from the inspected page.
|
||||
* @param callback A function that receives the list of resources when the request completes.
|
||||
@ -1690,6 +1701,15 @@ declare namespace chrome.devtools.inspectedWindow {
|
||||
export var onResourceAdded: ResourceAddedEvent;
|
||||
/** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */
|
||||
export var onResourceContentCommitted: ResourceContentCommittedEvent;
|
||||
|
||||
export interface EvalOptions {
|
||||
/** If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page. */
|
||||
frameURL?: string;
|
||||
/** Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the isError field set to true and the code field set to E_NOTFOUND. */
|
||||
useContentScriptContext?: boolean;
|
||||
/** Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext. */
|
||||
contextSecurityOrigin?: string;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user