mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-05 23:27:55 +02:00
UI: Search and read NS API docs in editor tab and documentation tab (#2163)
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
import Root from "./doc/index.md?raw";
|
||||
import { AllPages } from "./pages";
|
||||
import { EventEmitter } from "../utils/EventEmitter";
|
||||
|
||||
export type Document = typeof Root;
|
||||
export const getPage = (title: string): string => {
|
||||
const pageContent = AllPages[title];
|
||||
if (pageContent == null) {
|
||||
const errorMessage = `Cannot find ${title} page.`;
|
||||
console.error(errorMessage);
|
||||
return errorMessage;
|
||||
}
|
||||
return pageContent;
|
||||
};
|
||||
|
||||
export const getPage = (title: string): Document => AllPages[title] ?? Root;
|
||||
export const DocumentationPopUpEvents = new EventEmitter<[string | undefined]>();
|
||||
|
||||
export function openDocumentationPopUp(path: string): void {
|
||||
DocumentationPopUpEvents.emit(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user