Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

simplified a ?: to a ||

  • Loading branch information...
commit edc2e6ae7a0ca5edd031b99890c65182945ed867 1 parent fa82371
John Hann authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 examples/{tinyImageUploader.js → tinyImageLoader.js}
6 examples/tinyImageUploader.js → examples/tinyImageLoader.js
@@ -2,7 +2,7 @@
2 2 // promises. It's so simple, you could use the tiny.js
3 3 // or tiny2.js implementations.
4 4
5   -function imageUploader (src) {
  5 +function imageLoader (src) {
6 6 var promise = new Promise(),
7 7 img = document.createElement('img');
8 8 img.onload = function () {
@@ -13,11 +13,11 @@ function imageUploader (src) {
13 13 };
14 14 img.src = src;
15 15 // if you're using tiny2.js, return promise.safe;
16   - return promise;
  16 + return promise.safe || promise;
17 17 }
18 18
19 19 // example usage:
20   -imageUploader('http://google.com/favicon.ico').then(
  20 +imageLoader('http://google.com/favicon.ico').then(
21 21 function gotIt (img) {
22 22 document.body.appendChild(img);
23 23 },

0 comments on commit edc2e6a

Please sign in to comment.
Something went wrong with that request. Please try again.