malsup / cycle2

2nd gen cycling
899 stars 239 forks source link

Are `cycle-update-view-before/after` events safe to use in production code? #862

Open pjetrucha opened 2 years ago

pjetrucha commented 2 years ago

Hi @malsup, First of all I don't know if the project is still being maintained so I don't know if this is a significant question at all :)

My use case is that I want to get the index of the next slide after every slide change. I tried the cycle-after event, but the state is not refreshed yet:

el.on('cycle-after', (e, api) => {
   api.nextSlide; // it actually returns the index of the current slide to which the transition was made
});

There is a documented cycle-update-view event, but it fires twice with each change, so still not ideal.

While browsing the code, I found the following events: cycle-update-view-before and cycle-update-view-after which would be perfect for my use case, but I don't see them in the documentation.

Can you confirm that I can use them safely in production for my purposes?