The nodejs.channel object inherits from React Native's EventEmitter class, with emit removed and post and send added.
In the Node layer:
The rn_bridge.channel object inherits from Node's EventEmitter class, with emit removed and post and send added.
I'm assuming these statements are still true. If they are, then the type defs in index.d.ts are a little incomplete based on my understanding of how this plugin works. A notable example is addListener on the React Native layer, which – in React Native 0.66.3 – should return a React Native EventSubscription. At the moment, it's typed as:
According to the documentation here:
In the React Native layer:
In the Node layer:
I'm assuming these statements are still true. If they are, then the type defs in
index.d.ts
are a little incomplete based on my understanding of how this plugin works. A notable example isaddListener
on the React Native layer, which – in React Native 0.66.3 – should return a React Native EventSubscription. At the moment, it's typed as:addListener: (event: string, callback: ChannelCallback, context?: any) => void;
but the return type should instead be the subscription.