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 {
|
export default class App extends Component {
|
||||||
state = {
|
state = {
|
||||||
|
...State.create(),
|
||||||
connectParams: {
|
connectParams: {
|
||||||
url: null,
|
url: null,
|
||||||
pass: null,
|
pass: null,
|
||||||
|
@ -126,10 +127,7 @@ export default class App extends Component {
|
||||||
autoconnect: false,
|
autoconnect: false,
|
||||||
autojoin: [],
|
autojoin: [],
|
||||||
},
|
},
|
||||||
servers: new Map(),
|
|
||||||
buffers: new Map(),
|
|
||||||
bouncerNetworks: new Map(),
|
bouncerNetworks: new Map(),
|
||||||
activeBuffer: null,
|
|
||||||
connectForm: true,
|
connectForm: true,
|
||||||
loading: true,
|
loading: true,
|
||||||
dialog: null,
|
dialog: null,
|
||||||
|
|
7
state.js
7
state.js
|
@ -161,6 +161,13 @@ let lastBufferID = 0;
|
||||||
let lastMessageKey = 0;
|
let lastMessageKey = 0;
|
||||||
|
|
||||||
export const State = {
|
export const State = {
|
||||||
|
create() {
|
||||||
|
return {
|
||||||
|
servers: new Map(),
|
||||||
|
buffers: new Map(),
|
||||||
|
activeBuffer: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
updateServer(state, id, updater) {
|
updateServer(state, id, updater) {
|
||||||
let server = state.servers.get(id);
|
let server = state.servers.get(id);
|
||||||
if (!server) {
|
if (!server) {
|
||||||
|
|
Loading…
Reference in a new issue