Permalink
Browse files

address @spicyj's code review comments: more commenting and check aga…

…inst null instead of `typeof ... "undefined"`
  • Loading branch information...
1 parent f083f55 commit e7fa93cc2ae49d1966aead8e4f5142ee9277b33a @divad12 divad12 committed Dec 1, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 khan-exercise.js
View
@@ -2458,9 +2458,11 @@ var Khan = (function() {
// 4) now B finishes updating X and overwrites A(X) with B(X)
// ...when what we actually wanted saved is B(A(X)). We should really fix it
// on the server by running the hint and attempt requests in transactions.
- if ( typeof queue !== "undefined" ) {
+ if ( queue != null ) {
+ // Create an empty jQuery object to use as a queue holder, if needed.
requestQueue[queue] = requestQueue[queue] || jQuery( {} );
+ // Queue up sending the request to run when old requests have completed.
requestQueue[queue].queue(function(next) {
sendRequest().always( next );
});

0 comments on commit e7fa93c

Please sign in to comment.