blockly > Variables > promptName

Variables.promptName() function

Prompt the user for a new variable name.

Signature:

export declare function promptName(promptText: string, defaultText: string, callback: (p1: string | null) => void): void;

Parameters

Parameter Type Description
promptText string The string of the prompt.
defaultText string The default value to show in the prompt's field.
callback (p1: string | null) => void A callback. It will be passed the new variable name, or null if the user picked something illegal.

Returns:

void