File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -7587,15 +7587,11 @@ declare namespace chrome {
7587
7587
7588
7588
/**
7589
7589
* Saves the content of the tab with given id as MHTML.
7590
- * @param callback Called when the MHTML has been generated.
7591
- * Parameter mhtmlData: The MHTML data as a Blob.
7592
- */
7593
- export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData?: Blob) => void): void;
7594
- /**
7595
- * Saves the content of the tab with given id as MHTML.
7596
- * @since Chrome 116 MV3
7590
+ *
7591
+ * Can return its result via Promise in Manifest V3 or later since Chrome 116.
7597
7592
*/
7598
7593
export function saveAsMHTML(details: SaveDetails): Promise<Blob | undefined>;
7594
+ export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData?: Blob) => void): void;
7599
7595
}
7600
7596
7601
7597
////////////////////
Original file line number Diff line number Diff line change @@ -4285,9 +4285,16 @@ function testI18n() {
4285
4285
chrome . i18n . getUILanguage ( ) ; // $ExpectType string
4286
4286
}
4287
4287
4288
- async function testPageCapture ( ) {
4289
- chrome . pageCapture . saveAsMHTML ( { tabId : 0 } , ( data : Blob | undefined ) => { } ) ; // $ExpectType void
4290
- await chrome . pageCapture . saveAsMHTML ( { tabId : 0 } ) ; // $ExpectType Blob | undefined
4288
+ // https://developer.chrome.com/docs/extensions/reference/api/pageCapture
4289
+ function testPageCapture ( ) {
4290
+ const details = { tabId : 0 } ;
4291
+
4292
+ chrome . pageCapture . saveAsMHTML ( details ) ; // $ExpectType Promise<Blob | undefined>
4293
+ chrome . pageCapture . saveAsMHTML ( details , ( data ) => { // $ExpectType void
4294
+ data ; // $ExpectType Blob | undefined
4295
+ } ) ;
4296
+ // @ts -expect-error
4297
+ chrome . pageCapture . saveAsMHTML ( details , ( ) => { } ) . then ( ( ) => { } ) ;
4291
4298
}
4292
4299
4293
4300
// https://developer.chrome.com/docs/extensions/reference/api/downloads
You can’t perform that action at this time.
0 commit comments