bigbite/macy.js

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

Closed this issue · 2 comments

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

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

@jrmd Thanks a lot for the clarification!