summaryrefslogtreecommitdiff
path: root/hi-ui/src/store/channels.js
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-10-09 15:32:52 -0400
committerKit La Touche <kit@transneptune.net>2024-10-09 15:32:52 -0400
commitbd53a51af835478d23bef4772ce7e50553dc3fdf (patch)
tree3f190a47b9f704c412d0ff684b959abf003b8e5b /hi-ui/src/store/channels.js
parentdd62b823e01934a0f841256fdb17b551091896bf (diff)
Move a lot of things around
Diffstat (limited to 'hi-ui/src/store/channels.js')
-rw-r--r--hi-ui/src/store/channels.js71
1 files changed, 0 insertions, 71 deletions
diff --git a/hi-ui/src/store/channels.js b/hi-ui/src/store/channels.js
deleted file mode 100644
index 20702cc..0000000
--- a/hi-ui/src/store/channels.js
+++ /dev/null
@@ -1,71 +0,0 @@
-export class Channels {
- constructor() {
- this.channels = [];
- }
-
- setChannels(channels) {
- this.channels = [...channels];
- this.sort();
- return this;
- }
-
- addChannel(channel) {
- this.channels = [...this.channels, channel];
- this.sort();
- return this;
- }
-
- deleteChannel(id) {
- const channelIndex = this.channels.map((e) => e.id).indexOf(id);
- if (channelIndex !== -1) {
- this.channels.splice(channelIndex, 1);
- }
- return this;
- }
-
- sort() {
- this.channels.sort((a, b) => {
- if (a.name < b.name) {
- return -1;
- } else if (a.name > b.name) {
- return 1;
- }
- return 0;
- });
- }
-}
-
-export class ActiveChannel {
- constructor() {
- this.channel = null;
- }
-
- isSet() {
- return this.channel !== null;
- }
-
- get() {
- return this.channel;
- }
-
- is(id) {
- return this.channel === id;
- }
-
- set(id) {
- this.channel = id;
- return this;
- }
-
- deleteChannel(id) {
- if (this.is(id)) {
- return this.clear();
- }
- return this;
- }
-
- clear() {
- this.channel = null;
- return this;
- }
-}