Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with extension API Game events #377

Open
n0samu opened this issue Aug 16, 2022 · 0 comments
Open

Problems with extension API Game events #377

n0samu opened this issue Aug 16, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@n0samu
Copy link
Member

n0samu commented Aug 16, 2022

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's oldGame and newGame both reference the new Game.
    • onDidUpdatePlaylist's oldPlaylist and newPlaylist both reference the new Playlist. This makes it impossible to detect playlist renames.
    • onDidUpdatePlaylistGame's oldGame and newGame 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 and onDidUpdatePlaylistGame.

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.

@n0samu n0samu added the bug Something isn't working label Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant