
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Vanilla JavaScript classes on your finger-tips. so you can focus on your project.
Relaxx! I got you!
Request a Feature
Fixed CDN links
: now usablefunction px()
: now usableEvery website need some common elements to be implemented for a consistent UI/UX. Here are some simple UI components and funtionalities just a function call away. These all classes & functions are a solution to the problems that I faced while developing various websites, I bundled them together here.
Use these functionalities because:
• Include the main.js
file in your project and create a new instance of a class.
<script src="path/to/main.js"></script>
<!-- OR -->
<script src="https://cdn.jsdelivr.net/gh/devashishp1999/utils-deva@main/main.min.js"></script>
<script>
const toast = new Toast();
toast.show(); // Show default toast
</script>
npm i utils-deva
https://devashishp1999.github.io/utils-deva/main.min.js
or
https://cdn.jsdelivr.net/gh/devashishp1999/utils-deva@main/main.min.js
The Toast class provides a simple and flexible way to create and manage toast notifications in your web application. It allows you to easily customize the look, position and behavior of the toasts, and provides methods for showing, hiding and removing toasts.
To show a toast, call the show()
method on the Toast instance and pass in an options object.
toast.show({
text: "Hello World",
position: "top",
duration: 3,
styles: {
backgroundColor: "red",
color: "white",
fontSize: "20px",
},
animations: {
slideIn: "1s",
},
fonts: {
fontFamily: "Arial",
},
});
To remove a specific toast, call the remove()
method on the Toast instance and pass in the toast element as an argument.
toast.remove(toastElement);
To remove all toasts, call the removeAll()
method on the Toast instance.
toast.removeAll();
The options object passed to the show()
method can include the following properties:
text
(string): The text to display in the toast (default: "Toast text").position
(string): The position of the toast. Available options are "top", "bottom", "center", "left" and "right" (default: "bottom").duration
(number): The duration in seconds for which the toast should be displayed (default: 3).onClose
(function): A callback function that is invoked when the toast is closed (default: null).styles
(object): An object containing custom CSS styles to be applied to the toast (default: {}).animations
(object): An object containing custom CSS animations to be applied to the toast (default: {}).fonts
(object): An object containing custom fonts to be applied to the toast (default: {}).const toast = new Toast();
toast.show({
text: "Hello World",
position: "top",
duration: 2.5,
styles: {
backgroundColor: "red",
color: "white",
fontSize: "20px",
},
animations: {
slideIn: "1s",
},
fonts: {
fontFamily: "Arial",
},
});
This will create a new toast with the text "Hello World" and position it on the top of the screen and it will be removed after 3000ms. Also the toast will slide in from 1s with custom background color, color and font size and font family.
This library uses querySelector
and appendChild
which are supported by all modern browsers.
Docs are not updated :
Contact devashishp1999@gmail.com
This library is released under the MIT license
Hope this library will be helpful for you.
FAQs
utility functions and classes at finger-tips
The npm package utils-deva receives a total of 14 weekly downloads. As such, utils-deva popularity was classified as not popular.
We found that utils-deva demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.