Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show error message alert in MV3 #42

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import chromeP from 'webext-polyfill-kinda';
import {isBackground} from 'webext-detect-page';
import {isUrlPermittedByManifest} from 'webext-permissions';
import {getTabUrl} from 'webext-tools';
import alert from 'webext-alert';
import {executeFunction} from 'webext-content-scripts';

const contextMenuId = 'webext-domain-permission-toggle:add-permission';
Expand Down Expand Up @@ -106,12 +107,12 @@ async function handleClick(
await executeFunction(
tab.id,
text => {
alert(text); /* Can't pass a raw native function */
window.alert(text); /* Can't pass a raw native function */
},
String(error),
);
} catch {
alert(error); // One last attempt
void alert(String(error));
}
}

Expand Down
29 changes: 28 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
}
},
"dependencies": {
"webext-alert": "^0.9.0",
"webext-content-scripts": "^2.6.1",
"webext-detect-page": "^5.0.0",
"webext-permissions": "^3.1.2",
Expand Down