bigbite / macy.js

http://macyjs.com/
MIT License
1.28k stars 156 forks source link

Update readme on: how to run once all the images have loaded #59

Closed vincentorback closed 4 years ago

vincentorback commented 5 years ago

The readme states:

If you only require it to run once all the images have loaded you
can achieve this by passing null as the first parameter:

macyInstance.runOnImageLoad(function () {
console.log('I only get called when all images are loaded');
macyInstance.recalculate(true, true);
});

But in the example true and true is provided. What’s the correct way to specify that you only want to run once all the images have loaded.

Thanks for this great lib!

jrmd commented 4 years ago

Hi @vincentorback

Sorry for the late response, the documentation here is invalid and references the function from a previous version.

runOnImageLoad takes two paramaters, the first being a function (the callback) the second being a boolean. If you pass true, as the second parameter then it will run on every image load but if not then it will run at the end

vincentorback commented 4 years ago

@jrmd Thanks a lot for the clarification!