UNPKG

type2docfx

Version:

A tool to convert json format output from TypeDoc to universal reference model for DocFx to consume.

37 lines 1.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const internal_1 = require("./internal"); /** * :package: **botbuilder-prompts** * * Creates a new prompt that asks the user to enter some text. * * **Usage Example:** * * ```JavaScript * const { createTextPrompt } = require('botbuilder-prompts'); * * const namePrompt = createTextPrompt(async (context, value) => { * if (value && value.length >= 3) { * return value; * } * await namePrompt.prompt(context, `Your entry must be at least 3 characters in length.`); * return undefined; * }); * ``` * @param O (Optional) type of result returned by the `recognize()` method. This defaults to return a `string` but can be changed by the prompts custom validator. * @param validator (Optional) validator for providing additional validation logic or customizing the prompt sent to the user when invalid. */ function createTextPrompt(validator) { return { prompt: function prompt(context, prompt, speak) { return internal_1.sendPrompt(context, prompt, speak); }, recognize: function recognize(context) { const value = context.activity && context.activity.text ? context.activity.text : ''; return Promise.resolve(validator ? validator(context, value) : value); } }; } exports.createTextPrompt = createTextPrompt; //# sourceMappingURL=textPrompt.js.map