appcache-nanny
Advanced tools
Comparing version 0.0.6 to 1.0.0
@@ -123,2 +123,6 @@ // appCacheNanny | ||
clearInterval(intervalPointer); | ||
// check with offline interval | ||
checkInterval = hasNetworkError ? appCacheNanny.get('offlineCheckInterval') : appCacheNanny.get('checkInterval'); | ||
intervalPointer = setInterval(appCacheNanny.update, checkInterval); | ||
@@ -221,2 +225,13 @@ isCheckingForUpdatesFlag = true; | ||
// https://github.com/gr2m/appcache-nanny/issues/7 | ||
if (applicationCache.status !== applicationCache.UNCACHED) { | ||
subscribeToEvents(); | ||
setupPending = false; | ||
setupDone = true; | ||
setupCallbacks.forEach(function(callback) { | ||
callback(); | ||
}); | ||
return; | ||
} | ||
// load the appcache-loader.html using an iframe | ||
@@ -331,6 +346,3 @@ iframe = document.createElement('iframe'); | ||
// reset check interval | ||
checkInterval = appCacheNanny.get('checkInterval'); | ||
appCacheNanny.start(); | ||
trigger('online'); | ||
@@ -354,4 +366,2 @@ } | ||
// check with offline interval | ||
checkInterval = appCacheNanny.get('offlineCheckInterval'); | ||
appCacheNanny.start(); | ||
@@ -381,9 +391,2 @@ | ||
appCacheNanny.stop(); | ||
// Tell the user that an update is waiting on next page reload | ||
if (! hasUpdateFlag) { | ||
hasUpdateFlag = true; | ||
// don't use trigger here, otherwise the event wouldn't get triggered | ||
appCacheNanny.trigger('updateready'); | ||
} | ||
} | ||
@@ -390,0 +393,0 @@ |
{ | ||
"name": "appcache-nanny", | ||
"version": "0.0.6", | ||
"version": "1.0.0", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Gregor Martynus <gregor@martynus.net>" |
{ | ||
"name": "appcache-nanny", | ||
"version": "0.0.6", | ||
"version": "1.0.0", | ||
"description": "Teaches the applicationCache douchebag some manners!", | ||
"main": "appcache-nanny.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node ./bin/test-browser.js", | ||
"start": "node ./bin/dev-server.js" | ||
}, | ||
@@ -23,3 +24,15 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/gr2m/appcache-nanny" | ||
"homepage": "https://github.com/gr2m/appcache-nanny", | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"chai-as-promised": "^4.1.1", | ||
"colors": "^1.0.3", | ||
"hapi": "^8.1.0", | ||
"mocha": "^2.1.0", | ||
"moment": "^2.9.0", | ||
"sauce-connect-launcher": "^0.9.3", | ||
"selenium-standalone": "^2.44.0-4", | ||
"wd": "^0.3.11" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -6,2 +6,4 @@ The appCache Nanny | ||
[![Build Status](https://travis-ci.org/gr2m/appcache-nanny.svg)](https://travis-ci.org/gr2m/appcache-nanny) | ||
As we all know, the [Application Cache is a Douchbag](http://alistapart.com/article/application-cache-is-a-douchebag). | ||
@@ -90,25 +92,16 @@ It's time to teach it some manners – The appCache Nanny for Rescue! | ||
```js | ||
cd server | ||
node index.js | ||
# optionally pass a custom port number: | ||
# node index.js 1234 | ||
npm start | ||
``` | ||
It will start a local server at http://localhost:8888 (per default). | ||
It will start a local server at http://localhost:8888. | ||
Each time the `index.html` gets loaded, the background changes. Try by reloading | ||
the page. Then hit the `Check for update` button, you will see a few log meesages | ||
below. If you reload the page again, the color will change one more time (it's the | ||
index.html that just got downloaded in the background). But if you reload again, | ||
it won't change any more. You can now stop the server, you will still be able to | ||
restart the page. | ||
This is a static server with a few hidden features: | ||
In order to simulate a change in the application, hit the `Bump revision` button | ||
(make sure to start the server again beforehand). If you check for an update again, | ||
you will see that a new version got downloaded, it now says `has update? yes` on top. | ||
- `GET /bump-version` increases the app version, so an update gets triggered | ||
on next check | ||
- `GET /remove-manifest` makes `GET /manifest.appcache` return 404, so it | ||
becomes obsolete on next check | ||
- `GET /recreate-manifest` undoes the previous step. | ||
Note that every path will show the index.html file, try http://localhost:8888/some/path | ||
for example. | ||
Gotchas | ||
@@ -115,0 +108,0 @@ ------- |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2028666
188
27022
0
9
164
16