mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-28 18:45:51 -05:00
Add State.create()
This commit is contained in:
parent
0b0467f019
commit
e7f8620933
2 changed files with 8 additions and 3 deletions
|
@ -116,6 +116,7 @@ function showNotification(title, options) {
|
|||
|
||||
export default class App extends Component {
|
||||
state = {
|
||||
...State.create(),
|
||||
connectParams: {
|
||||
url: null,
|
||||
pass: null,
|
||||
|
@ -126,10 +127,7 @@ export default class App extends Component {
|
|||
autoconnect: false,
|
||||
autojoin: [],
|
||||
},
|
||||
servers: new Map(),
|
||||
buffers: new Map(),
|
||||
bouncerNetworks: new Map(),
|
||||
activeBuffer: null,
|
||||
connectForm: true,
|
||||
loading: true,
|
||||
dialog: null,
|
||||
|
|
7
state.js
7
state.js
|
@ -161,6 +161,13 @@ let lastBufferID = 0;
|
|||
let lastMessageKey = 0;
|
||||
|
||||
export const State = {
|
||||
create() {
|
||||
return {
|
||||
servers: new Map(),
|
||||
buffers: new Map(),
|
||||
activeBuffer: null,
|
||||
};
|
||||
},
|
||||
updateServer(state, id, updater) {
|
||||
let server = state.servers.get(id);
|
||||
if (!server) {
|
||||
|
|
Loading…
Reference in a new issue