
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@garage-panda/use-before-unload
Advanced tools
[](https://badge.fury.io/js/%40garage-panda%2Fuse-before-unload)
A React hook that uses the onbeforeunload (beforeunload) event and tracks when the user has been Refreshed or Canceled the default browser message. It is impossible to track if the user has left the page and is not a good idea to execute code after that.
npm i @garage-panda/use-before-unload
import React from "react";
import { useBeforeUnload } from "@garage-panda/use-before-unload";
function App() {
const setEnabledBeforeUnload = useBeforeUnload({
initEnable: false, // do you need to be enabled by default
onRefresh: () => {
// the page has been refreshed (the user has clicked Reload)
},
onCancel: () => {
// the user has clicked Cancel
}
});
React.useEffect(() => {
setEnabledBeforeUnload(true); // you can dynamically enable or disable the beforeunload event
if (!sessionStorage.length) {
// the only way to know that the user has land on your site (and has not refreshed the page)
}
}, []);
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If you like what you see, feel free to support us!
FAQs
[](https://badge.fury.io/js/%40garage-panda%2Fuse-before-unload)
We found that @garage-panda/use-before-unload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.