Add MobX store, create observable User.

This commit is contained in:
Paul
2021-07-29 12:41:28 +01:00
parent 781fa5de10
commit cf3930b094
10 changed files with 247 additions and 61 deletions

View File

@@ -5,6 +5,8 @@ import { StateUpdater } from "preact/hooks";
import { dispatch } from "../../redux";
import { DataStore } from "../../mobx";
import { useData } from "../../mobx/State";
import { ClientOperations, ClientStatus } from "./RevoltClient";
export var preventReconnect = false;
@@ -18,6 +20,7 @@ export function registerEvents(
{ operations }: { operations: ClientOperations },
setStatus: StateUpdater<ClientStatus>,
client: Client,
store: DataStore,
) {
function attemptReconnect() {
if (preventReconnect) return;
@@ -45,6 +48,7 @@ export function registerEvents(
},
packet: (packet: ClientboundNotification) => {
store.packet(packet);
switch (packet.type) {
case "ChannelStartTyping": {
if (packet.user === client.user?._id) return;