error-shelter
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -8,5 +8,12 @@ // errorShelter.js - Extends the native Error method and stores errors into localStorage obj | ||
var config = { | ||
nameSpace : 'errorShelter',//can be changed to fit app needs | ||
nameSpace : 'errorShelter', //can be changed to fit app needs | ||
availableGlobal : true, // make the nameSpace available either GLOBAL.nameSpace || window.nameSpace | ||
}; | ||
// The available methods exposed for API consumption | ||
var publicApi = { | ||
getStorage : getStorage, | ||
emptyStorage : initializeEmptyStorage | ||
}; | ||
if (!localStorage) { return console.warn('errorShelter.js - localStorage not supported.'); } | ||
@@ -69,8 +76,13 @@ | ||
if (config.availableGlobal) { | ||
if (window) { | ||
window[config.nameSpace] = publicApi; | ||
} | ||
} | ||
window.Error = errorShelter; | ||
window.Error[config.nameSpace] = { | ||
getStorage : getStorage, | ||
emptyStorage : initializeEmptyStorage | ||
}; // makes these methods accessible on the Error method | ||
window.Error[config.nameSpace] = publicApi; | ||
})(); |
{ | ||
"name": "error-shelter", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "frontend error catch and storage utility for JS apps.", | ||
@@ -5,0 +5,0 @@ "main": "errorShelter.js", |
# error-shelter | ||
An error logger/handler/storage for front-end apps. Ties in with native JS Error as well as utilizes localStorage for error log preservation which is great for developers wishing to debug user issues. | ||
Use errors as normal: | ||
``` | ||
throw new Error('This is an error...'); | ||
``` | ||
Then retrieve storage whenever: | ||
``` | ||
Error.errorShelter.getStorage(); | ||
``` |
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
5561
7
81
13