Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
trusasha authored Jan 5, 2024
1 parent 7eedc69 commit 4426fb2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ const playbackListener = Player.addListener('onPlaybackStateChange', state => {
playbackListener.remove();
```

### Managing Event Listeners
To maintain optimal performance and prevent memory leaks, it's important to manage your event listeners effectively. Here's how you can add and remove listeners using the `Player` class.
```javascript
const playbackListener = Player.addListener('onPlaybackStateChange', state => {
console.log('New Playback State:', state);
});
```
```javascript
// This will remove all listeners for 'onPlaybackStateChange' event
Player.removeAllListeners('onPlaybackStateChange');
```


### Searching the Catalog
Search the Apple Music catalog:

Expand Down Expand Up @@ -156,7 +169,7 @@ function MusicPlayerComponent() {
## Bugs and feature requests
Bug or a feature request, [please open a new issue](https://github.com/Lomray-Software/vite-ssr-boost/issues/new).
Bug or a feature request, [please open a new issue](https://github.com/Lomray-Software/react-native-apple-music/issues/new).
## License
Made with 💚
Expand Down

0 comments on commit 4426fb2

Please sign in to comment.