@@ -19,8 +19,35 @@ export namespace Chrome {
1919 */
2020 readonly buildId ?: string ;
2121
22+ /**
23+ * Returns the `content` and `encoding` of the resource. If a `callback`
24+ * is provided, it is invoked with the `content` and `encoding` and the
25+ * method returns `void`. If no `callback` is provided, the method returns
26+ * a `Promise`.
27+ *
28+ * @param callback Optional callback to be invoked with the content and
29+ * encoding.
30+ * @returns A Promise that resolves to an object containing the content
31+ * and encoding if no callback is provided, otherwise void. Rejects with
32+ * an error object on failure.
33+ */
34+ getContent ( ) : Promise < { content : string , encoding : string } > ;
2235 getContent ( callback : ( content : string , encoding : string ) => unknown ) : void ;
23- setContent ( content : string , commit : boolean , callback ?: ( error ?: Object ) => unknown ) : void ;
36+
37+ /**
38+ * Sets the content of the resource. If a `callback` is provided, it is
39+ * invoked when the content is set and the method returns `void`. If no
40+ * `callback` is provided, the method returns a `Promise`.
41+ *
42+ * @param content The new content of the resource.
43+ * @param commit Whether to commit the changes.
44+ * @param callback Optional callback to be invoked when the content is
45+ * set.
46+ * @returns A Promise that resolves when the content is set if no callback
47+ * is provided, otherwise void. Rejects with an error object on failure.
48+ */
49+ setContent ( content : string , commit : boolean ) : Promise < void > ;
50+ setContent ( content : string , commit : boolean , callback : ( error ?: object ) => unknown ) : void ;
2451 /**
2552 * Augments this resource's scopes information based on the list of {@link NamedFunctionRange}s
2653 * for improved debuggability and function naming.
@@ -40,18 +67,62 @@ export namespace Chrome {
4067 onResourceAdded : EventSink < ( resource : Resource ) => unknown > ;
4168 onResourceContentCommitted : EventSink < ( resource : Resource , content : string ) => unknown > ;
4269
43- eval (
44- expression : string ,
45- options ?: { scriptExecutionContext ?: string , frameURL ?: string , useContentScriptContext ?: boolean } ,
46- callback ?: ( result : unknown , exceptioninfo : {
47- code : string ,
48- description : string ,
49- details : unknown [ ] ,
50- isError : boolean ,
51- isException : boolean ,
52- value : string ,
53- } ) => unknown ) : void ;
70+ /**
71+ * Evaluates a JavaScript expression in the context of the inspected page.
72+ *
73+ * If a `callback` is provided, it is invoked with the result and
74+ * exception information and the method returns `void`. If no `callback`
75+ * is provided, the method returns a `Promise`.
76+ *
77+ * @template E The type of the value that the Promise resolves to.
78+ * @param expression The JavaScript expression to evaluate.
79+ * @param optionsOrCallback Optional options for evaluation, or a callback
80+ * function.
81+ * @param callback Optional callback to be invoked with the evaluation
82+ * result and exception information.
83+ * @returns A Promise that resolves to the result if no callback is
84+ * provided, otherwise void. Rejects with an error object on failure.
85+ */
86+ eval < E = unknown > ( expression : string , options ?: {
87+ scriptExecutionContext ?: string ,
88+ frameURL ?: string ,
89+ useContentScriptContext ?: boolean ,
90+ } ) : Promise < E > ;
91+ eval ( expression : string ,
92+ optionsOrCallback : { scriptExecutionContext ?: string , frameURL ?: string , useContentScriptContext ?: boolean } |
93+ undefined | ( ( result : unknown , exceptioninfo : {
94+ code : string ,
95+ description : string ,
96+ details : unknown [ ] ,
97+ isError : boolean ,
98+ isException : boolean ,
99+ value : string ,
100+ } ) => unknown ) ,
101+ callback ?: ( result : unknown , exceptioninfo : {
102+ code : string ,
103+ description : string ,
104+ details : unknown [ ] ,
105+ isError : boolean ,
106+ isException : boolean ,
107+ value : string ,
108+ } ) => unknown ) : void ;
109+
110+ /**
111+ * Retrieves all resources within the inspected window.
112+ *
113+ * If a `callback` is provided, it is invoked with the array of resources
114+ * and the method returns `void`. If no `callback` is provided, the method
115+ * returns a `Promise`.
116+ *
117+ * @param callback Optional callback to be invoked with the array of
118+ * resources.
119+ * @returns A Promise that resolves to an array of resources if no
120+ * callback is provided, otherwise void. Rejects with an error object on
121+ * failure.
122+ */
123+ getResources ( ) : Promise < Resource [ ] > ;
54124 getResources ( callback : ( resources : Resource [ ] ) => unknown ) : void ;
125+
55126 reload ( reloadOptions ?: { ignoreCache ?: boolean , injectedScript ?: string , userAgent ?: string } ) : void ;
56127 }
57128
0 commit comments