move to global scope

This commit is contained in:
omuretsu 2022-10-11 20:01:10 -04:00
parent 84b99c569a
commit 7d07f44b3e
3 changed files with 7 additions and 9 deletions

@ -546,7 +546,6 @@ export const RamCosts: RamCostTree<Omit<NSFull, "args" | "enums">> = {
// Easter egg function
break: 0,
},
printRaw: 0,
formulas: {
mockServer: 0,

@ -4,8 +4,6 @@ import * as bcrypt from "bcryptjs";
import { Apr1Events as devMenu } from "../ui/Apr1";
import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { helpers } from "../Netscript/NetscriptHelpers";
import { ReactNode } from "react";
import { Terminal } from "../Terminal";
export interface INetscriptExtra {
heart: {
@ -16,7 +14,6 @@ export interface INetscriptExtra {
bypass(doc: Document): void;
alterReality(): void;
rainbow(guess: string): void;
printRaw(node: ReactNode): void;
}
export function NetscriptExtra(): InternalAPI<INetscriptExtra> {
@ -78,9 +75,5 @@ export function NetscriptExtra(): InternalAPI<INetscriptExtra> {
}
return tryGuess();
},
printRaw: () => (node: unknown) => {
// Just wraps the internal function to allow player use - players can use at own risk
Terminal.printRaw(node as ReactNode);
},
};
}

@ -1,3 +1,9 @@
import { Terminal as TTerminal } from "./Terminal/Terminal";
import { ReactNode } from "react";
declare global {
interface Window {
tprintRaw: (node: ReactNode) => void;
}
}
export const Terminal = new TTerminal();
window["tprintRaw"] = Terminal.printRaw.bind(Terminal);