diff --git a/libs/libevent_doc.txt b/libs/libevent_doc.txt new file mode 100644 index 0000000..c75c19d --- /dev/null +++ b/libs/libevent_doc.txt @@ -0,0 +1,46 @@ +NAME + libevent - For easier event handling. + +FUNCTIONS + SetEventTranslator(event_name : string, callback : function) + Set external event translator. + + AddEventListener(EventName : string, CallbackFunction : function) : number + Add event listener. Return event listener id. + + RemoveEventListener(ListenerID : number) : boolean + Remove event listener. Only listener id is required. + + WaitEventEx(...) : Event + Equivalent to event.pull(...), but return event package. + + WaitEvent([timeout : number],[event name : string]) : Event + WaitEvent([event name : string],[timeout : number]) : Event -- Deprecated + Simpler waiting event. + + WaitMultipleEvent(...) : Event + Equivalent to event.pullMultiple(...), but return event package. + + PushEvent(EventName : string,...) + Equivalent to event.push(EventName,...) + + AddTimer(Interval : number, CallbackFunction : function, Times : number) : number + Equivalent to event.timer(Interval,CallbackFunction,Times). Times will be math.huge if <0. + + RemoveTimer(TimerID : number) : boolean + Equivalent to event.cancel(TimerID) + + CreateEventBus() : EventBus + Create a event bus. The event bus works like a FIFO queue. + + EventBusListen(t : EventBus, event_name : string, checkfn : function) + EventBus:listen(event_name : string, checkfn : function) + Listen a event. All listened events will be automatically added to event bus. + If checkfn presents, it will be called before adding events. If it returns true, then event will be added. + + EventBus:next([wait_second : number],[wait_ratio : number]) + Get an event from event bus. By default, EventBus:next() will wait until an listened event happens. + + EventBus:close() + Clean up internal buffer and listeners. + The programmer is responsible for calling this method. (because OC does not support __gc meta-method.) \ No newline at end of file diff --git a/programs.info b/programs.info index 441c14b..c68c7f8 100644 --- a/programs.info +++ b/programs.info @@ -26,7 +26,11 @@ title="LibEvent", info="For easier event processing", files={ - ["libs/libevent.lua"]="libevent.lua" + ["libs/libevent.lua"]="libevent.lua", + ["libs/libevent_doc.txt"]={ + "/usr/man/libevent", + "/tmp/libevent_doc.txt" + } }, requires={ "checkarg"