Skip to main content

PromptManager

PromptManager class

The PromptManager class orchestrates all spawning of prompts and returning of changed data.

const prompts = new PromptManager(/* PromptManagerOptions (optional) */)

The class accepts an optional PromptManagerOptions object as a parameter:

PropertyRequiredDefaultDetails
widthNo600Sets the width of the prompt window
baseHeightNo112The minimum height of the window before content. Prompt window is automatically sized-up for content
resizableNofalseAllows the user to resize spawned prompts
promptFileNosrc/static/prompt/prompt.htmlSet the html file that will be loaded in the prompt window. See Creating a prompt HTML file.
devModeNofalseEnables verbose logging
logLevelNo3Highest level logs to display when devMode is false. By default, only [WARN] and greater severity logs are shown.
devLogLevelNo6Highest level logs to display when devMode is true. By default, all severity logs are shown.

Usage example

const prompts = new PromptManager({
devMode: true,
resizable: true,
})

Log levels

electron-prompts uses log levels to control log verbosity.

These levels are set using the logLevel and devLogLevel properties in the PromptManagerOptions object:

LevelLabelDescription
0nullMandatory logs, no tag will be printed.
1[FATAL]Fatal error.
2[ERROR]General error.
3[WARN]General warning.
4[INFO]Information.
5[DEBUG]Debugging information.
6[TRACE]Trace logging.