Skip to content

Commit

Permalink
Small refactoring in handleStackObject()
Browse files Browse the repository at this point in the history
  • Loading branch information
peol committed Mar 14, 2012
1 parent 2a7e7d6 commit 2b95342
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions lib/basket.js
Expand Up @@ -52,29 +52,26 @@
key = storagePrefix + ( obj.key || obj.url ), key = storagePrefix + ( obj.key || obj.url ),
waitCount = globalWaitCount, waitCount = globalWaitCount,
scriptIndex = scripts.length, scriptIndex = scripts.length,
source = localStorage.getItem( key ); source = localStorage.getItem( key ),
callback = function( text ) {
scripts[ scriptIndex ] = text;
queueExec( waitCount, obj.execute );
};


if ( !obj.url ) { if ( !obj.url ) {
return; return;
} }


if ( obj.execute !== false ) { obj.execute = obj.execute !== false;
obj.execute = true;
}

scripts[ scriptIndex ] = null; scripts[ scriptIndex ] = null;


if ( source ) { if ( source ) {
scripts[ scriptIndex ] = source; callback( source );
queueExec( waitCount, obj.execute );
} else { } else {
saveUrl( obj.url, key, function( text ) { saveUrl( obj.url, key, callback );
scripts[ scriptIndex ] = text;
queueExec( waitCount, obj.execute );
});
} }


if ( obj.wait ) { if ( isFunc(obj.wait) ) {
basket.wait( obj.wait ); basket.wait( obj.wait );
} }
}, },
Expand Down

0 comments on commit 2b95342

Please sign in to comment.