+/** An implementation of EventHandler */
export interface EventHandlerInterface {
+ /**Handles the given [`Event`].
+ *
+ * See [`EventsProvider`] for details that must be considered when implementing this method.
+ */
handle_event(event: Event): void;
}
held: EventHandler;
}
+/**
+ * A trait implemented for objects handling events from [`EventsProvider`].
+ */
export class EventHandler extends CommonBase {
/* @internal */
public bindings_instance?: bindings.LDKEventHandler;
this.bindings_instance = null;
}
- static new_impl(arg: EventHandlerInterface): EventHandler {
+ /** Creates a new instance of EventHandler from a given implementation */
+ public static new_impl(arg: EventHandlerInterface): EventHandler {
const impl_holder: LDKEventHandlerHolder = new LDKEventHandlerHolder();
let structImplementation = {
handle_event (event: number): void {
impl_holder.held.bindings_instance = structImplementation;
return impl_holder.held;
}
+
+ /**
+ * Handles the given [`Event`].
+ *
+ * See [`EventsProvider`] for details that must be considered when implementing this method.
+ */
public handle_event(event: Event): void {
bindings.EventHandler_handle_event(this.ptr, event == null ? 0 : CommonBase.get_ptr_of(event) & ~1);
}