To make ZIM Pages display Page automatically without having the user to swipe Page

I have a ZIM Pages (pages) with 10 ZIM Page (page1,page2, etc....). I want Pages to display each Page one by one until the end and reverse display back. Pages start with page1. I use pages.go(page2,'right') to display page2. I have: pages.on("page", ()=>{
zog(pages.page.name);
zog('i am here');
}) ;
questions:

  1. pages.go(page2,'right') does not seem to trigger pages.on("page",..). Is this correct?
  2. How to properly implement that automatic page display regarding the number of pages?

ok, i found it. I used interval(). So far, it fulfills my need. But i would love to know when and how to trigger the pages.on("page"). Thank you.

Ok, i also found it. Thank you.

Good. Yes, in general, events are not triggered when you programmatically call a method. Because at that time, you are in control and can add whatever you would put in the event function after calling the method. And this avoids circular calling. So we tend to leave events for user initiated things, and perhaps loading.

1 Like