blob: 79868f46d1f8502865639713b463651b4ee743c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import { DateTime } from 'luxon';
class Conversation {
static boot({ at, id, name }) {
return new Conversation({
at: DateTime.fromISO(at),
id,
name,
});
}
constructor({ at, id, name }) {
this.at = at;
this.id = id;
this.name = name;
}
}
export class Conversations {
all = $state([]);
add({ at, id, name }) {
this.all.push(Conversation.boot({ at, id, name }));
}
remove(id) {
this.all = this.all.filter((conversation) => conversation.id !== id);
}
}
|