Skip to content

@loontail/minecraft-kit v0.8.14 / ProgressEvent

Type alias: ProgressEvent

ts
type ProgressEvent: ProgressEventContext & 
  | {
  phase: InstallPhase;
  previous: InstallPhase | null;
  type: "install:phase-changed";
 }
  | {
  expectedSize: number;
  file: FileRef;
  type: "download:started";
 }
  | {
  bytesDownloaded: number;
  file: FileRef;
  totalBytes: number;
  type: "download:progress";
 }
  | {
  file: FileRef;
  type: "download:skipped";
 }
  | {
  bytes: number;
  durationMs: number;
  file: FileRef;
  type: "download:completed";
 }
  | {
  error: Error;
  file: FileRef;
  type: "download:failed";
  willRetry: boolean;
 }
  | {
  algorithm: "sha1" | "sha256";
  file: FileRef;
  hash: string;
  type: "integrity:verified";
 }
  | {
  actual: string;
  algorithm: "sha1" | "sha256";
  expected: string;
  file: FileRef;
  type: "integrity:mismatch";
 }
  | {
  archive: string;
  fileCount: number;
  target: string;
  type: "archive:extracted";
 }
  | {
  processor: ProcessorRef;
  total: number;
  type: "forge:processor-started";
 }
  | {
  durationMs: number;
  exitCode: number;
  processor: ProcessorRef;
  type: "forge:processor-completed";
 }
  | {
  path: string;
  processor: ProcessorRef;
  type: "forge:processor-output-verified";
 }
  | {
  file: VerificationFileResult;
  type: "verify:file-checked";
 }
  | {
  args: readonly string[];
  command: string;
  cwd: string;
  type: "launch:starting";
 }
  | {
  pid: number;
  type: "launch:started";
 }
  | {
  line: string;
  type: "launch:stdout";
 }
  | {
  line: string;
  type: "launch:stderr";
 }
  | {
  code: number | null;
  signal: NodeJS.Signals | null;
  type: "launch:exited";
 }
  | {
  reason: string;
  type: "launch:aborted";
};

Discriminated union of all runtime progress events. Pass an onEvent callback to install.run, update.run, verify.run, repair.run, or launch.run to receive these.

Example

ts
import { EventTypes, type ProgressEvent } from "@loontail/minecraft-kit";

const onEvent = (e: ProgressEvent) => {
  if (e.type === EventTypes.DOWNLOAD_FAILED) console.error(e.file.target, e.error.message);
  if (e.type === EventTypes.LAUNCH_EXITED) console.log("game exited", e.code);
};

Source

src/types/events.ts:120

MIT License