Skip to content

jQuery-less imagesLoaded #46

Closed
desandro opened this Issue Dec 30, 2012 · 9 comments

3 participants

@desandro
Owner

I'm curious to gauge the interest in a version of imagesLoaded without the jQuery dependency.

Personally, I have Vanilla Masonry and other projects in the works which could benefit from a vanilla imagesLoaded.

Chime in if you're interested as well. :bell:

@darsain
Collaborator
darsain commented Dec 30, 2012

I'll take a shot at it. See what I'll run into :)

@darsain
Collaborator
darsain commented Jan 4, 2013

@desandro I have a working copy of dependency-less imagesloaded. It is 1.5KB minified, but works solely on callbacks. That is a drawback as returning a promise is something that really fits this library.

The problem is that the smallest Promises/A+ spec compliant implementation I found is 2 times larger than imagesLoaded itself, so I'm reluctant to attach it :)

So for now, it will be without promises. The repo is here: Darsain/imagesLoaded.

@desandro
Owner
desandro commented Jan 4, 2013

Wow, this is fantastic! Thank you so much for the work that went into this.

I agree on keeping out promises. Though, it might be worth considering building it in via bower.

@jonathanong

What about component? https://github.com/component/component

you can basically use other small libraries for nodeListToArray and below, cutting the source code almost in half

@darsain
Collaborator
darsain commented Jan 4, 2013

@jonathanong but than it would have dependencies :) It's just a ~1KB library. I don't want a little shit like this to have dependencies.

@desandro but optional use of promises if some of the popular promise libraries is present might be nice. I'll look into it.

@jonathanong

You have dependencies now, the only difference being they're hard coded. And a promise library would be a dependency as well.

@desandro
Owner
desandro commented Jan 4, 2013

Another thought, would it make sense to some how work this into the jQuery version? So the vanilla JS version would be the base, then we just provide a jQuery.fn wrapper for it, if present, then use jQuery deferreds, if present.

@darsain
Collaborator
darsain commented Jan 4, 2013

I've thought about it actually. Wrapping it with jQuery is not a problem at all. I'm trying to design my other libraries the exact same way. But I don't like that jQuery's current promises implementation is wrong :) I don't remember details, but it is mentioned somewhere in here: You're Missing the Point of Promises.

@desandro
Owner

Done in v3.

@desandro desandro closed this May 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.