View Single Post
Old 09-15-2020, 07:59 AM   #5
pazos
cosiņeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Carmelocotonto View Post
Thanks Pazos, but I don't understand "event" concept and how is its implementation. I don't know LUA. I have tried looking some LUA's files to use the same ideas, but I don't understand the concept. Can you tell me an example of event that is handled by the reader footer. Then I will try something similar.
functions that are part of an object and start with "on" are normally events, like https://github.com/koreader/koreader...ua#L1819-L1867

Instead of having to remember an instance of the object and its name to call the function you broadcast the event and each widget that can handle the event will react accordly to the event you broadcasted.

Have a look at https://github.com/koreader/koreader...broadcastEvent.

For a function called "onDoFoo" you broadcast a new event "DoFoo", and the event is delivered to all widgets and handled by widgets that implemented "onDoFoo"
pazos is offline   Reply With Quote