3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class BackgroundProcessor extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.BackgroundProcessor_free(this.ptr);
21 public static BackgroundProcessor constructor_start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) {
22 number ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, net_graph_msg_handler == null ? 0 : net_graph_msg_handler.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr);
23 const ret_hu_conv: BackgroundProcessor = new BackgroundProcessor(null, ret);
24 ret_hu_conv.ptrs_to.add(ret_hu_conv);
25 ret_hu_conv.ptrs_to.add(persister);
26 ret_hu_conv.ptrs_to.add(event_handler);
27 ret_hu_conv.ptrs_to.add(chain_monitor);
28 ret_hu_conv.ptrs_to.add(channel_manager);
29 ret_hu_conv.ptrs_to.add(net_graph_msg_handler);
30 ret_hu_conv.ptrs_to.add(peer_manager);
31 ret_hu_conv.ptrs_to.add(logger);
35 public Result_NoneErrorZ join() {
36 number ret = bindings.BackgroundProcessor_join(this.ptr);
37 Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
41 public Result_NoneErrorZ stop() {
42 number ret = bindings.BackgroundProcessor_stop(this.ptr);
43 Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);