]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/EventsProvider.ts
Update auto-generate bindings (incl new RL clone methods)
[ldk-java] / ts / structs / EventsProvider.ts
1
2             
3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
5
6
7
8             export class EventsProvider extends CommonBase {
9
10                 bindings_instance?: bindings.LDKEventsProvider;
11
12                 constructor(ptr?: number, arg?: bindings.LDKEventsProvider) {
13                     if (Number.isFinite(ptr)) {
14                                         super(ptr);
15                                         this.bindings_instance = null;
16                                     } else {
17                                         // TODO: private constructor instantiation
18                                         super(bindings.LDKEventsProvider_new(arg));
19                                         this.ptrs_to.push(arg);
20                                         
21                                     }
22                 }
23
24                 protected finalize() {
25                     if (this.ptr != 0) {
26                         bindings.EventsProvider_free(this.ptr);
27                     }
28                     super.finalize();
29                 }
30
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);
39                                                 },
40
41                                                 
42                     };
43                     impl_holder.held = new EventsProvider (null, structImplementation);
44                 }
45             }
46
47             export interface EventsProviderInterface {
48                 process_pending_events(handler: EventHandler): void;
49                                 
50             }
51
52             class LDKEventsProviderHolder {
53                 held: EventsProvider;
54             }
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);
58         }
59
60 }