mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
MISC: Remove js-sha256 (#1278)
This commit is contained in:
@@ -3,7 +3,7 @@ import { EventEmitter } from "../../utils/EventEmitter";
|
||||
import { Modal } from "./Modal";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
import { sha256 } from "js-sha256";
|
||||
import { cyrb53 } from "../../utils/StringHelperFunctions";
|
||||
|
||||
export const AlertEvents = new EventEmitter<[string | JSX.Element]>();
|
||||
|
||||
@@ -17,8 +17,8 @@ export function AlertManager({ hidden }: { hidden: boolean }): React.ReactElemen
|
||||
useEffect(
|
||||
() =>
|
||||
AlertEvents.subscribe((text: string | JSX.Element) => {
|
||||
const hash = getMessageHash(text);
|
||||
setAlerts((old) => {
|
||||
const hash = getMessageHash(text);
|
||||
if (old.some((a) => a.hash === hash)) {
|
||||
return old;
|
||||
}
|
||||
@@ -47,8 +47,10 @@ export function AlertManager({ hidden }: { hidden: boolean }): React.ReactElemen
|
||||
const alertMessage = alerts[0]?.text || "No alert to show";
|
||||
|
||||
function getMessageHash(text: string | JSX.Element): string {
|
||||
if (typeof text === "string") return sha256(text);
|
||||
return sha256(JSON.stringify(text.props));
|
||||
if (typeof text === "string") {
|
||||
return cyrb53(text);
|
||||
}
|
||||
return cyrb53(JSON.stringify(text.props));
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
|
||||
Reference in New Issue
Block a user