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

service getters return Array instead of Map #80

Merged
merged 14 commits into from
Sep 10, 2023

Conversation

Aylur
Copy link
Owner

@Aylur Aylur commented Sep 5, 2023

Currently services that have a Map containing objects like Hyprland.workspaces or Bluetooth.devices return their internal Map object. With this PR getter methods return an Array that can be easily iterated through with map and will have a get<Item> method that will still offer a way to get items by their id.

// instead of
Box({
  children: Array.from(Hyprland.workspaces.values()).map(ws => /* widget */),
});
const ws = Hyprland.workspaces.get(0);

// now
Box({
  children: Hyprland.workspaces.map(ws => /* widget */),
});
const ws = Hyprland.getWorkspace(0);

Also renamed Audio.microphone to Audio.source and Audio.speaker to Audio.sink

@DevAlien
Copy link
Contributor

DevAlien commented Sep 6, 2023

Great idea. for the microphone/speaker thing, for me, personally was more clear before. non native english speaker probably understand better microphone/speaker, source and especially sink is very techincal. But I also understand that who writes code should know these things

@Aylur
Copy link
Owner Author

Aylur commented Sep 6, 2023

speaker/microphone makes a lot more sense to me too as a non native speaker, but I feel the technical terms should be used regardless

@Aylur Aylur merged commit 3321e77 into main Sep 10, 2023
2 checks passed
@Aylur Aylur deleted the test/service-return-array-instead-of-map branch September 10, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants