3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export class EventsProvider extends CommonBase {
10 bindings_instance?: bindings.LDKEventsProvider;
12 constructor(ptr?: number, arg?: bindings.LDKEventsProvider) {
13 if (Number.isFinite(ptr)) {
15 this.bindings_instance = null;
17 // TODO: private constructor instantiation
18 super(bindings.LDKEventsProvider_new(arg));
19 this.ptrs_to.push(arg);
24 protected finalize() {
26 bindings.EventsProvider_free(this.ptr);
31 static new_impl(arg: EventsProviderInterface): EventsProvider {
32 const impl_holder: LDKEventsProviderHolder = new LDKEventsProviderHolder();
33 let structImplementation = <bindings.LDKEventsProvider>{
34 // todo: in-line interface filling
35 process_pending_events (handler: number): void {
36 EventHandler ret_hu_conv = new EventHandler(null, handler);
37 ret_hu_conv.ptrs_to.add(this);
38 arg.process_pending_events(ret_hu_conv);
43 impl_holder.held = new EventsProvider (null, structImplementation);
47 export interface EventsProviderInterface {
48 process_pending_events(handler: EventHandler): void;
52 class LDKEventsProviderHolder {
55 public void process_pending_events(EventHandler handler) {
56 bindings.EventsProvider_process_pending_events(this.ptr, handler == null ? 0 : handler.ptr);
57 this.ptrs_to.add(handler);