Skip to content

Commit

Permalink
Bump to 0.5.2. Rebuild releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
addyosmani committed Feb 7, 2015
1 parent 30d8569 commit f35feab
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dist/basket.full.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/basket.full.min.js.map

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions dist/basket.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* basket.js
* v0.5.1 - 2014-08-16
* v0.5.2 - 2015-02-07
* http://addyosmani.github.com/basket.js
* (c) Addy Osmani; License
* Created by: Addy Osmani, Sindre Sorhus, Andrée Hansson, Mat Scales
Expand All @@ -12,6 +12,7 @@
var head = document.head || document.getElementsByTagName('head')[0];
var storagePrefix = 'basket-';
var defaultExpiration = 5000;
var inBasket = [];

var addLocalStorage = function( key, storeObj ) {
try {
Expand Down Expand Up @@ -58,7 +59,8 @@

xhr.onreadystatechange = function() {
if ( xhr.readyState === 4 ) {
if( xhr.status === 200 ) {
if ( ( xhr.status === 200 ) ||
( ( xhr.status === 0 ) && xhr.responseText ) ) {
resolve( {
content: xhr.responseText,
type: xhr.getResponseHeader('content-type')
Expand Down Expand Up @@ -123,7 +125,7 @@

obj.key = ( obj.key || obj.url );
source = basket.get( obj.key );

obj.execute = obj.execute !== false;

shouldFetch = isCacheValid(source, obj);
Expand All @@ -147,6 +149,7 @@
}
} else {
source.type = obj.type || source.originalType;
source.execute = obj.execute;
promise = new RSVP.Promise( function( resolve ){
resolve( source );
});
Expand Down Expand Up @@ -177,7 +180,7 @@
};

var performActions = function( resources ) {
resources.map( function( obj ) {
return resources.map( function( obj ) {
if( obj.execute ) {
execute( obj );
}
Expand Down Expand Up @@ -207,6 +210,16 @@

window.basket = {
require: function() {
for ( var a = 0, l = arguments.length; a < l; a++ ) {
arguments[a].execute = arguments[a].execute !== false;

if ( arguments[a].once && inBasket.indexOf(arguments[a].url) >= 0 ) {
arguments[a].execute = false;
} else if ( arguments[a].execute !== false && inBasket.indexOf(arguments[a].url) < 0 ) {
inBasket.push(arguments[a].url);
}
}

var promise = fetch.apply( null, arguments ).then( performActions );

promise.thenRequire = thenRequire;
Expand Down
4 changes: 2 additions & 2 deletions dist/basket.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/basket.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "basket.js",
"version": "0.5.1",
"version": "0.5.2",
"description": "A script-loader that handles caching scripts in localStorage where supported",
"keywords": [
"script",
Expand Down

0 comments on commit f35feab

Please sign in to comment.