Skip to content

Commit

Permalink
version 0.7.5 -- see changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisben committed Oct 16, 2014
1 parent d90efea commit 78030bb
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 103 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
### IMPROVED ###
* ImgCache.getCachedFileURL: error callback is now optional (#79)
* Cache directory is no more backed up in iCloud (iOS) (#73)
* Added ability to override the hash method through ImgCache.overridables.hash, SHA-1 currently being the default. It's possible to plug in a faster alternative but be careful of possible collisions (#81)
* The log method used throughout ImgCache is now defined as an overridable option: ImgCache.overridables.log -- this replaces the previous 'customLogger' optional method (read Backward Compability Warning below)
* Fixed some JSLint issues

### BC WARNING ###
* ImgCache.options.customLogger has been changed to ImgCache.overridables.log

## 0.7.4 ##

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ Options
See ImgCache.options at the top of the source file for the list of options.
Options can be overridden from your own script, no need to modify the library!

Overridable methods
-------------------
* The hash method used by default in ImgCache is SHA-1. It was chosen for its near absence of collision. Though it might slow things down if you have a large number of files to cache (see #81). You can plug-in your own method by overriding ImgCache.overridables.hash.
* If logging is enabled, ImgCache output some log entries in the console by default. You can override ImgCache.overridables.log in order to change this behaviour.

Unit tests
----------
Open index.html and click 'Start unit tests' to launch unit tests.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imgcache.js",
"version": "0.7.4",
"version": "0.7.5",
"homepage": "https://github.com/chrisben/imgcache.js",
"authors": [
{
Expand Down
18 changes: 9 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

var logger = function (str, level) {
var levelClass = '';
if (level == LOG_LEVEL_INFO) { levelClass = 'info' } ;
if (level == LOG_LEVEL_WARNING) { levelClass = 'warn' };
if (level == LOG_LEVEL_ERROR) { levelClass = 'error' };
if (level == LOG_LEVEL_INFO) { levelClass = 'info' } ;
if (level == LOG_LEVEL_WARNING) { levelClass = 'warn' };
if (level == LOG_LEVEL_ERROR) { levelClass = 'error' };
$('#log').append($('<li></li>').addClass(levelClass).text(str));
};

Expand All @@ -35,7 +35,7 @@
var testedMethods = {};

ImgCache.options.debug = true;
ImgCache.options.customLogger = logger;
ImgCache.overridables.log = logger;
ImgCache.options.cacheClearSize = 10;
var default_options = ImgCache.options;

Expand Down Expand Up @@ -108,7 +108,7 @@
name: 'getCachedFile',
test: function (ok, nok) {
// expected result: failure
ImgCache.getCachedFile($test_img.attr('src'), function (src, file_entry) { if (file_entry) { nok(); } else { ok(); } });
ImgCache.getCachedFile($test_img.attr('src'), function (src, file_entry) { if (file_entry) { nok(); } else { ok(); } });
}
},
{
Expand All @@ -128,7 +128,7 @@
test: function (ok, nok) {
var img_src = getBackgroundImageUrl($test_div);
if (img_src) {
ImgCache.isCached(img_src, function (src, res) { if (res) { ok(); } else { nok(); } });
ImgCache.isCached(img_src, function (src, res) { if (res) { ok(); } else { nok(); } });
} else {
nok();
}
Expand All @@ -147,7 +147,7 @@
nok();
}
});
} else {
} else {
nok();
}
}
Expand Down Expand Up @@ -314,7 +314,7 @@

var countTestedMethods = 0;
for (var key in testedMethods) {
if (testedMethods.hasOwnProperty(key)) { countTestedMethods++ };
if (testedMethods.hasOwnProperty(key)) { countTestedMethods++ };
}

var coverage = 'API coverage: ' + countTestedMethods + '/' + countTotalMethods;
Expand All @@ -323,7 +323,7 @@
for (var i = 0; i < testableMethods.length; i++) {
var method = testableMethods[i];
if (!testedMethods.hasOwnProperty(method)) {
if (untestedMethods.length > 0) {
if (untestedMethods.length > 0) {
untestedMethods += ' / ';
}
untestedMethods += method;
Expand Down
Loading

0 comments on commit 78030bb

Please sign in to comment.