NativeUpdatedValue
NativeUpdatedValue
The subscription object behind most on* exports (onPlaybackChanged, onQueueChanged, onTrackMetadata, …). Subscribe with addListener; the returned function unsubscribes. The emitter is not callable itself.
It listens to native from module load. The remote-control exports and onGate use LazyNativeEmitter, which listens only once a listener is added. It keeps no payload: use the getter (getQueue, getActiveTrack, …) for the current value.
Example
typescript
import { onPlaybackChanged } from 'react-native-audio-browser'
const unsubscribe = onPlaybackChanged.addListener((p) => {
console.log(p.state)
})
// later:
unsubscribe()Type Parameters
| Type Parameter |
|---|
T |
Methods
addListener()
ts
addListener(callback): () => void;Subscribes to value changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | Callback<T> | Invoked with each new value |
Returns
A function that removes the listener
ts
(): void;Returns
void