
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
appcache-autoupdate
Advanced tools
Browser library for automated updates of offline first applications
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Auto Updates for Offline First Applications
Install using bower for usage in browser:
bower install --save appcache-autoupdate
Make sure the manifest
attribute is set on the <html>
tag.
<html manifest="appcache.manifest">
<script src="appache-autoupdate.js">
AutoUpdate starts checking automatically for updates every
30 seconds. To prevent that, add data-autoupdate="false"
.
You can also alter the check interval by setting a time
in ms: data-autoupdate="10000"
.
The JS API:
// event API
AutoUpdate.on('updateready', reloadPage)
// AutoUpdate also offers reliable online/offline events
// in case the cache manifest could not be downloaded
AutoUpdate.on('offline', showOfflineIndicator)
AutoUpdate.on('online', hideOfflineIndicator)
// set interval for checking for updates in ms
// (default is 30000)
AutoUpdate.setInterval(60000)
// set alternative interval when offline
AutoUpdate.setOfflineInterval(30000)
// reload page when routing, if update is ready
function onRoute(event) {
if (AutoUpdate.hasUpdate()) {
location.reload(1)
}
}
I extracted appCache-autoupdate.js
out of minutes.io, which is an Offline First
web application, anno 2011. It's battle tested by a ton of users, devices, internet environment.
minutes.io checks every 30 seconds if an update is available. And whenever the user navigates from one view to another, it reloads the page in case there is. As the assets are all cached, the user cannot tell that his page got just reloaded. It's silent, without any notification, or a prompt asking the user to reload the page. And it works very well so far.
I don't have a demo app ready yet, I'm happily accepting pull requests though. But here's my idea for a tiny node.js app, hosted for free on Heroku or whereever:
appcache.manifest
that changes every 30stheme.css
that changes the background color every time it gets requestedappCache Autoupdate has been authored by Gregor Martynus, proud member of Team Hoodie. Support our work: gittip us.
License: MIT
FAQs
Browser library for automated updates of offline first applications
We found that appcache-autoupdate 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.