LazyNativeEmitter
LazyNativeEmitter
The subscription object behind the remote-control exports (onRemotePlay, onRemoteSeek, …) and onGate. Subscribe with addListener; the returned function unsubscribes. The emitter is not callable itself.
Native starts delivering the event only once the first listener is added. The other on* exports use NativeUpdatedValue, which listens from module load.
Example
typescript
import { onRemotePlay } from 'react-native-audio-browser'
const unsubscribe = onRemotePlay.addListener(() => console.log('play'))
// later:
unsubscribe()Type Parameters
| Type Parameter |
|---|
T |
Methods
addListener()
ts
addListener(callback): () => void;Subscribes to the event.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | Callback<T> | Invoked with each event |
Returns
A function that removes the listener
ts
(): void;Returns
void