pixi-console - v5.1.1
    Preparing search index...

    Interface PixiConsoleInit

    Options accepted by the PixiConsole constructor. Every field is optional.

    interface PixiConsoleInit {
        width?: number;
        height?: number;
        visible?: boolean;
        captureConsole?:
            | boolean
            | readonly ("log" | "info" | "debug" | "warn" | "error")[];
        captureErrors?: boolean;
        captureClear?: boolean;
        showOnError?: boolean;
        filter?: readonly ("log" | "info" | "debug" | "warn" | "error")[];
        maxEntries?: number;
        collapseRepeats?: boolean;
        timestamps?: boolean;
        textRenderer?: "bitmap" | "canvas";
        fontFamily?: string;
        fontSize?: number;
        lineHeight?: number;
        resolution?: number;
        padding?: number;
        backgroundColor?: ColorSource;
        backgroundAlpha?: number;
        toolbar?: boolean;
        interactive?: boolean;
        toggleKey?: string | null;
        autoResize?: AutoResizeOptions | null;
        prompt?: boolean;
        commands?: Readonly<Record<string, ConsoleCommand | CommandHandler>>;
        evaluator?: ConsoleEvaluator | null;
        colors?: Partial<
            Record<"log" | "info" | "debug" | "warn" | "error", ColorSource>,
        >;
        format?: Partial<FormatOptions>;
    }

    Hierarchy

    Index
    width?: number

    Width of the console in pixels.

    800
    
    height?: number

    Height of the console in pixels.

    400
    
    visible?: boolean

    Whether the console starts visible.

    false
    
    captureConsole?:
        | boolean
        | readonly ("log" | "info" | "debug" | "warn" | "error")[]

    Which console methods are captured. true captures every level, false none. Can be changed later via PixiConsole.captureConsole.

    true
    
    captureErrors?: boolean

    Capture uncaught errors and unhandled promise rejections.

    true
    
    captureClear?: boolean

    Clear the console when console.clear() is called.

    true
    
    showOnError?: boolean

    Show the console automatically when an error is logged or thrown.

    true
    
    filter?: readonly ("log" | "info" | "debug" | "warn" | "error")[]

    Levels that are displayed. Hidden levels are still recorded and can be re-enabled later. Command-line input and results are always displayed.

    all levels
    
    maxEntries?: number

    Maximum number of entries kept in memory. Oldest entries are dropped first. Can be changed later via PixiConsole.maxEntries.

    1000
    
    collapseRepeats?: boolean

    Merge consecutive identical messages into one line with a (×N) counter. Can be changed later via PixiConsole.collapseRepeats.

    true
    
    timestamps?: boolean

    Prefix every entry with its time (HH:MM:SS.mmm). Can be changed later via PixiConsole.timestamps.

    false
    
    textRenderer?: "bitmap" | "canvas"

    How text is rendered.

    • "bitmap": BitmapText using a glyph atlas generated on the fly. Cheap to update, recommended.
    • "canvas": Text, better for scripts with huge glyph sets (CJK) or colour emoji.
    "bitmap"
    
    fontFamily?: string
    "Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', monospace"
    
    fontSize?: number
    14
    
    lineHeight?: number

    Height of one line of text.

    round(fontSize * 1.4)
    
    resolution?: number

    Resolution of the rendered glyphs. By default they follow the renderer's resolution (before the console is first rendered, the autoResize renderer's or window.devicePixelRatio).

    the renderer's resolution
    
    padding?: number

    Inner padding in pixels.

    8
    
    backgroundColor?: ColorSource
    0x0d1117
    
    backgroundAlpha?: number
    0.85
    
    toolbar?: boolean

    Show the toolbar with per-level filter toggles, clear and close buttons. Can be changed later via PixiConsole.toolbar.

    true
    
    interactive?: boolean

    Enable wheel and drag scrolling and toolbar buttons. Set to false to let pointer events pass through. The command line stays tappable when prompt is on.

    true
    
    toggleKey?: string | null

    KeyboardEvent.code or KeyboardEvent.key that toggles the console, or null to disable. Ignored while typing in a text field. With prompt, opening the console with it focuses the command line when nothing else on the page has focus.

    "Backquote"
    
    autoResize?: AutoResizeOptions | null

    Keep the console sized to the renderer screen, e.g. across orientation changes.

    null
    
    prompt?: boolean

    Show a command line under the log. Entering a line runs a command or, when no command matches, the evaluator. It is a native <input> placed over the canvas, so on-screen keyboards, IME and paste work as usual (autocorrect and autocapitalize are off). Keys typed into it don't reach your game's keydown listeners (capture-phase ones still see them) or the toggleKey; keyup still does, so no key gets stuck. Opening the console with toggleKey focuses it when nothing else on the page has focus. Needs pixi.js 8.7+ or autoResize to find the canvas. Can be changed later via PixiConsole.prompt.

    false
    
    commands?: Readonly<Record<string, ConsoleCommand | CommandHandler>>

    Commands for the command line and PixiConsole.execute, by name, added to the built-in help and clear. A function is shorthand for { run }. Names are one word (/^[a-z][\w:-]*$/i) and case-insensitive; a command named like a built-in replaces it.

    { spawn: { usage: "<count>", description: "Spawn enemies", run: ([count = "1"]) => game.spawn(Number(count)) } }
    
    {}
    
    evaluator?: ConsoleEvaluator | null

    Runs lines whose first word is not a command, e.g. createJsEvaluator to evaluate JavaScript. null answers "Unknown command" instead. Whoever can type into the console can run it: keep JavaScript evaluation out of production builds. Can be changed later via PixiConsole.evaluator.

    null
    
    colors?: Partial<
        Record<"log" | "info" | "debug" | "warn" | "error", ColorSource>,
    >

    Text colour per level. Levels left out keep their colour from DEFAULT_COLORS.

    format?: Partial<FormatOptions>

    Options for turning logged values into text. Fields left out keep their default.