Skip to main content

spawn() method

The async spawn() method spawns a prompt window given a passed Prompt Template:

const prompts = new PromptManager()
const promptTemplate = {
windowTitle: "electron-prompts",
elements: [
{
type: "header",
value: "The easiest prompts ever!",
},
{
type: "paragraph",
value: "An easy tool to enable spawning prompts from the Electron main process",
},
],
buttons: [
{
name: "accept",
classes: ["btn", "btn-primary"],
value: "Accept and continue",
},
],
}
const result = await prompts.spawn(promptTemplate)

The method will wait for the user to submit or cancel the prompt before resolving.

Arguments

NameRequiredDefaultDetails
promptTemplateYesN/AThe Prompt Template to use when spawning the prompt and returning data

Returns

Returns (resolves) a Prompt Result object if the prompt was submitted, or null if it was cancelled