Add State.create()

This commit is contained in:
Simon Ser 2021-09-21 12:33:22 +02:00
parent 0b0467f019
commit e7f8620933
2 changed files with 8 additions and 3 deletions

View file

@ -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,

View file

@ -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) {