feat: add RegisterConsoleCallback; add api verson check method#17
Open
langfod wants to merge 5 commits intoPrismaUI-SKSE:devfrom
Open
feat: add RegisterConsoleCallback; add api verson check method#17langfod wants to merge 5 commits intoPrismaUI-SKSE:devfrom
langfod wants to merge 5 commits intoPrismaUI-SKSE:devfrom
Conversation
- addedRequestPluginAPI() to safely return a simple api version like check - added UpdateExternalDeps.ps1 to sync submodule and check for UL file
… js_console_callback
There was a problem hiding this comment.
Pull request overview
This PR adds a new JavaScript console callback API to PrismaUI, allowing consumer plugins to receive JavaScript console messages (console.log, console.warn, console.error, etc.) from their views. The PR also introduces API versioning through GetAPIVersion() to enable safe backward compatibility checks, preventing crashes when newer plugins interact with older PrismaUI DLLs. Additionally, it includes build infrastructure improvements and a critical CMake configuration fix.
Changes:
- Added RegisterConsoleCallback() API for receiving JavaScript console messages with proper thread safety via SKSE task dispatching
- Added GetAPIVersion() for defensive version checking before calling new API features
- Fixed critical CMake version requirement from invalid 4.1 to correct 3.21
- Added build configuration management with local overrides support
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.cpp | Exports GetPrismaUIAPIVersion() returning version 2 |
| src/PrismaUI_API.h | Adds ConsoleMessageLevel enum, ConsoleMessageCallback typedef, RegisterConsoleCallback() declaration, and GetAPIVersion() implementation |
| src/PrismaUI/ViewManager.h | Declares RegisterConsoleCallback() function signature |
| src/PrismaUI/ViewManager.cpp | Implements RegisterConsoleCallback() with thread-safe callback registration |
| src/PrismaUI/Listeners.cpp | Implements OnAddConsoleMessage() to invoke registered console callbacks |
| src/PrismaUI/Core.h | Adds consoleMessageCallback field to PrismaView struct |
| src/API/API.h | Declares RegisterConsoleCallback() in plugin API interface |
| src/API/API.cpp | Implements callback wrapping for game thread dispatch via SKSE tasks |
| CMakeLists.txt | Fixes invalid cmake_minimum_required version from 4.1 to 3.21 |
| BuildRelease.ps1 | Adds configuration file management with template and local overrides |
| Build_Config_Template.ps1 | Provides template for local build configuration |
| UpdateExternalDeps.ps1 | Adds script for managing external dependencies and git submodules |
| .gitignore | Excludes Build_Config_Local.ps1 from version control |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
StarkMP
reviewed
Feb 18, 2026
StarkMP
reviewed
Feb 18, 2026
StarkMP
reviewed
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RegisterConsoleCallback() allows a plugin to request JS console logs specific to their View.
The public ABI is version and RegisterConsoleCallback() is only available using
IVPrismaUI2.Plugin developer should test if
IVPrismaUI2is available before using the function in case the end-user has an older version of the PrismaUI DLL.In game testing:
Nexus PrismaUI
Several Nexus Prisma Mods.
Custom mod with and without new header and no change code
Custom mod with updated both new API's
Updated PrismaUI
Several Nexus Prisma Mods.
Custom mod with and without new header and no change code
Custom mod with updated both new API's
Console Callback API
PrismaUI exposes a mechanism for consumer plugins to receive JavaScript console messages (
console.log,console.warn,console.error, etc.) from their views.Requesting the V2 Interface
RegisterConsoleCallbackis part of theIVPrismaUI2interface. Use the templateRequestPluginAPIto request it:If the loaded PrismaUI DLL does not support
IVPrismaUI2, the call returnsnullptr. This allows your plugin to gracefully degrade when users have an older PrismaUI version installed.Interface version history
IVPrismaUI1CreateViewthroughHasAnyActiveFocus)IVPrismaUI2RegisterConsoleCallbackRegisterConsoleCallback
Register a callback to receive JavaScript console messages from a specific view.
Parameters
nullptrto unregister.Callback signature
ConsoleMessageLevel enum
Threading
The callback is dispatched on the game thread via
SKSE::GetTaskInterface()->AddTask(), consistent with other PrismaUI callbacks likeRegisterJSListenerandOnDomReadyCallback. It is safe to call SKSE/RE functions from within the callback.Scope
Each view has its own isolated JavaScript context. Registering a console callback on your view only receives messages from your view. Other plugins using PrismaUI are not affected and their messages are not visible to your callback.
What it catches
Because this hooks into Ultralight's native
OnAddConsoleMessagelistener, it captures more than justconsole.log()calls:console.log(),console.warn(),console.error(),console.info(),console.debug()console.assert()failuresFull Example
Minimal Example (without version guard)
If your plugin requires the latest PrismaUI and doesn't need to support older versions: