Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
toast-loader
Advanced tools
Toast is a promise-based asset loader for JS and CSS files. It aims to optimize web site performance by loading and deferring the needed assets.
As a side note: Toast is packaged as an UMD module.
yarn add toast-loader
Since it have a small footprint, Toast can be loaded as soon as possible in the HEAD
tag:
<head>
<script src="node_modules/toast-loader/dist/toast.min.js"></script>
</head>
toast.css(url: string): Promise
toast.js(url: string): Promise
toast.all(urls: string[]): Promise
if (dark_mode === true) {
toast.css('styles/dark.css')
} else {
toast.css('styles/light.css')
}
toast.js('http://some.cdn.com/jquery.js').then(() => {
toast.js('http://some.cdn.com/jquery-myplugin.js').then(() => {
$('.someClass').myPlugin()
})
})
toast.all([
'assets/css/styles1.css',
'assets/css/styles2.css',
'assets/js/script1.js',
'assets/js/script2.js',
'assets/js/script3.js',
]).then(() => {
console.log('Everything has been loaded, yay!')
})
Toast is using built-in promises. If you need to support IE9-11, you must add the promise-polyfill library before loading Toast. Here's the compatibility table for the Promise feature.
IE9-IE11 and Edge never trigger error
event on CSS loading if something went wrong. Keep this in mind when you're using catch
promise block with Toast.
If you want to look at some feature supporting details, you can take a look at this compatibility table.
It worth noting that Toast has been designed to be compatible with modern browsers and IE9+. Supporting other older browsers would have a negative impact on the library size.
Install the dependencies with:
yarn install
Build the lib with:
yarn build
Tests are written with Mocha and Chai and run with Karma on LambdaTest.
First, you will need to set up you're own environment:
LT
command is accessible (e.g. in the PATH
).bashrc
:export LT_USERNAME="<your_username>"
export LT_ACCESS_KEY="<your_access_key>"
Finally, you can run the tests with:
yarn test
They will be run under the following browsers:
If needed, you can run the tests under only one browser with:
yarn chrome
yarn firefox
yarn edge
yarn ie11
yarn ie10
yarn ie9
yarn safari
Licensed under the MIT license.
FAQs
A modern JS/CSS asset loader
The npm package toast-loader receives a total of 473 weekly downloads. As such, toast-loader popularity was classified as not popular.
We found that toast-loader 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.