Skip to content

Commit ab6dd67

Browse files
committed
feat: allow to disable bridge and polyfills
1 parent 9ad6485 commit ab6dd67

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/webview/index.common.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,16 @@ export abstract class WebViewExtBase extends ContainerView {
527527
*/
528528
protected tempSuspendSrcLoading = false;
529529

530+
/**
531+
* Whether to install promise polyfill
532+
*/
533+
injectPolyfills = true;
534+
535+
/**
536+
* Whether to install event bridge
537+
*/
538+
injectBridge = true;
539+
530540
/**
531541
* Callback for the loadFinished-event. Called from the native-webview
532542
*/
@@ -1359,8 +1369,12 @@ export abstract class WebViewExtBase extends ContainerView {
13591369
* Inject WebView JavaScript Bridge.
13601370
*/
13611371
protected async injectWebViewBridge(): Promise<void> {
1362-
await this.executeJavaScript(webViewBridge, false);
1363-
await this.ensurePolyfills();
1372+
if (this.injectBridge) {
1373+
await this.executeJavaScript(webViewBridge, false);
1374+
}
1375+
if (this.injectPolyfills) {
1376+
await this.ensurePolyfills();
1377+
}
13641378
await this.injectViewPortMeta();
13651379
}
13661380

0 commit comments

Comments
 (0)