Problems with extension API Game events
n0samu opened this issue · 0 comments
n0samu commented
Describe the bug
(Note that all functions I reference are in back/game/GameManager.ts)
The launcher's extension API's Game and Playlist events have some bugs and inconsistencies:
- addPlaylistGame and removePlaylist do not fire any event.
- save, updatePlaylist and updatePlaylistGame pass identical "old" and "new" objects because the object is modified without first making a copy.
onDidUpdateGame
'soldGame
andnewGame
both reference the new Game.onDidUpdatePlaylist
'soldPlaylist
andnewPlaylist
both reference the new Playlist. This makes it impossible to detect playlist renames.onDidUpdatePlaylistGame
'soldGame
andnewGame
both reference the new PlaylistGame.
- It would be more convenient for API users if updating, adding and removing PlaylistGames fired the onDidUpdatePlaylist event.
Expected behavior
Here's how I'd personally expect the API to work:
- Removing a Playlist should fire an onDidRemovePlaylist event.
- Updating, adding and removing PlaylistGames should fire onDidUpdatePlaylist with the old and new Playlist object
- For example, in the Playlist Backup extension that I'm developing, I would like to get an event whenever the user updates a playlist so I can save the updated playlist to the backup file.
- Adding a Game/Playlist/PlaylistGame should fire the associated Update event with identical "old" and "new" objects.
- Thus addPlaylistGame should fire both
onDidUpdatePlaylist
andonDidUpdatePlaylistGame
.
Additional context
In the Playlist Backup extension that I'm developing, I would like to get an event whenever the user updates a playlist so I can save the updated playlist to the backup file. Some of my expectations are motivated by this.