appcache-nanny
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -61,2 +61,7 @@ // appCacheNanny | ||
var DEFAULT_MANIFEST_LOADER_PATH = '/appcache-loader.html'; | ||
var nannyOptions = { | ||
loaderPath: DEFAULT_MANIFEST_LOADER_PATH | ||
}; | ||
// | ||
@@ -141,2 +146,30 @@ // | ||
// | ||
// | ||
// | ||
appCacheNanny.set = function setOption(key, value) { | ||
var property, newSettings; | ||
if (typeof key === 'object') { | ||
newSettings = key; | ||
for (property in newSettings) if (newSettings.hasOwnProperty(property)) { | ||
nannyOptions[property] = newSettings[property]; | ||
} | ||
return; | ||
} | ||
nannyOptions[key] = value; | ||
}; | ||
// | ||
// | ||
// | ||
appCacheNanny.get = function getOption(key) { | ||
var property, settings = {}; | ||
if (key) return nannyOptions[key]; | ||
for (property in nannyOptions) if (nannyOptions.hasOwnProperty(property)) { | ||
settings[property] = nannyOptions[property]; | ||
} | ||
return settings; | ||
}; | ||
// Private | ||
@@ -186,3 +219,3 @@ // ------- | ||
iframe = document.createElement('iframe'); | ||
iframe.src = '/appcache-loader.html'; | ||
iframe.src = nannyOptions.loaderPath; | ||
iframe.style.display = 'none'; | ||
@@ -189,0 +222,0 @@ iframe.onload = function() { |
{ | ||
"name": "appcache-nanny", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Gregor Martynus <gregor@martynus.net>" |
{ | ||
"name": "appcache-nanny", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Teaches the applicationCache douchebag some manners!", | ||
@@ -5,0 +5,0 @@ "main": "appcache-nanny.js", |
@@ -9,4 +9,4 @@ The appCache Nanny | ||
No more manifest attributes on your HTML files. Weathere you want to cache | ||
your assets offline or not, when to start ... you are in control™ | ||
No more manifest attributes on your HTML files. Whether you want to cache | ||
your assets offline or not, when to start ... You Are In Control™ | ||
@@ -38,7 +38,13 @@ Have a glance: | ||
// plus some extra ones | ||
appCacheNanny.on('init:downloading', handleInitDownloading); | ||
appCacheNanny.on('init:progress', handleInitProgress); | ||
appCacheNanny.on('init:cached', handleInitCached); | ||
appCacheNanny.on('start', handleStart); | ||
appCacheNanny.on('stop', handleStop); | ||
appCacheNanny.on('init:downloading', handleInitDownloading) | ||
appCacheNanny.on('init:progress', handleInitProgress) | ||
appCacheNanny.on('init:cached', handleInitCached) | ||
appCacheNanny.on('start', handleStart) | ||
appCacheNanny.on('stop', handleStop) | ||
// options | ||
appCacheNanny.set('loaderPath', '/path/to/my-custom-loader.html') | ||
appCacheNanny.set({ 'loaderPath': '/path/to/my-custom-loader.html' }) | ||
appCacheNanny.get('loaderPath') | ||
appCacheNanny.get() // returns all options | ||
``` | ||
@@ -45,0 +51,0 @@ |
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
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
2021578
26603
170