Permalink
Browse files

simplified a ?: to a ||

  • Loading branch information...
1 parent fa82371 commit edc2e6ae7a0ca5edd031b99890c65182945ed867 unscriptable committed Feb 10, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 examples/{tinyImageUploader.js → tinyImageLoader.js}
View
6 examples/tinyImageUploader.js → examples/tinyImageLoader.js
@@ -2,7 +2,7 @@
// promises. It's so simple, you could use the tiny.js
// or tiny2.js implementations.
-function imageUploader (src) {
+function imageLoader (src) {
var promise = new Promise(),
img = document.createElement('img');
img.onload = function () {
@@ -13,11 +13,11 @@ function imageUploader (src) {
};
img.src = src;
// if you're using tiny2.js, return promise.safe;
- return promise;
+ return promise.safe || promise;
}
// example usage:
-imageUploader('http://google.com/favicon.ico').then(
+imageLoader('http://google.com/favicon.ico').then(
function gotIt (img) {
document.body.appendChild(img);
},

0 comments on commit edc2e6a

Please sign in to comment.