What codes around, comes around
About a year ago I tried to do a small image preloading script. All the existing solutions were very overkill for my needs and it also became really stressful to keep running into the same problem. So I tried to make a tiny library to help me.
I took advantage of the opportunity to also "play" a little with Github, as well as trying to create a documentation / presentation page for it.
The result turned out pretty neat and you can check it out here: PreloaderJS. Not only I enjoyed myself doing it, but it was also a good lesson. Reinventing the wheel is usually counter-productive but not when you are doing it for educational purposes!
Now, the greatest thing about PreloaderJS is that is was made by myself to serve my particular needs. It has three possible callback methods:
onComplete
, called after an attempt to preload all the images was made, irregardless of the resultonSuccess
, called only if all the images were successfully preloadedonError
, called when the script ran into errors while trying to load at least one image
Around... one month ago, I think, I ran again into this problem, trying to use the Masonry library. The author provides a helpful plugin, imagesLoaded, for cases like mine but unfortunately it just didn't work exactly like I wanted it and it was also way too bloated.
And then I remembered about PreloaderJS. I downloaded it from my old and forgotten Github repository, used it and discovered it worked like a charm! I also brushed up a little the repository afterwards, to give it the recognition it deserved but all things considered, the coolest part for me was finding again a use for something I made myself.
Everything you make as a programmer is useful in some way. At worse, it's because you learned something while doing it. But only when you discover that some long forgotten, seemingly insignificant thing is still helpful, it's then when you appreciate just how useful things are.