Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
coldboot
Advanced tools
Readme
A lightweight vanillaJs script to connect server-rendered static HTML to client-rendered application
install the package using npm
npm install coldboot
load the coldboot.js script in your page
<script async src="/node_modules/coldboot/dist/coldboot.min.js" onload="coldboot.init()" type="text/javascript"></script>
we expose coldboot
on window which has 2 methods init & complete.
coldboot.init
needs to be called to start listening to user events, and takes 2 parameters customLoaderId,customTextContainerId
these ids determine the element to show and the element where loader text is to be injected.
in markup , we can now add attributes cb-await='loader text'
& cb-await-id='loaderId'
to add a loader with custom text, the id provided in cb-await-id
is provided to the client application so that it can perform relevant actions.
add the attribute cb-persist='uniqueIdentifier'
to add a listener that will listen to 'input' events & store the value property of the element.
once client application is finished loading, it must call coldboot.complete()
.
doing this wil detach event listeners, hide the loader, update values for client rendered cb-persist
based on their unique identifiers.
coldboot.complete()
will also return an object with the map of all persisted-identifier to value in the preserve
key & the id provided in cb-await-id
in the awaitId
key to indicate which element was clicked.
if an interaction is observed, then the object will have the following form
{
awaitId:'submit',
preserve: { email:'donjoe@example.com'}
}
if no interaction is observed, then the object returned would be
{
awaitId : undefined,
preserve: {}
}
Optionally you can also subscribe to coldboot.onComplete().then(fn)
if you want to listen to complete on multiple places. When a valid element is present, it resolves with value -
{
awaitId:'submit',
preserve: { email:'donjoe@example.com'}
}
coldboot.onComplete is resolved after coldboot.complete() is called.
FAQs
A lightweight vanillaJs script to connect server-rendered static HTML to client-rendered application
The npm package coldboot receives a total of 32 weekly downloads. As such, coldboot popularity was classified as not popular.
We found that coldboot 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.