ChoiceSet class
定义 ChoiceSet 集合。
- 扩展
-
Array<Choice>
构造函数
Choice |
初始化 ChoiceSet 类的新实例。 |
属性
Array |
继承属性
length | 获取或设置数组的长度。 这是比数组中定义的最高元素更高的数字。 |
方法
bind(Dialog |
将数据绑定到模板。 |
继承的方法
构造函数详细信息
ChoiceSet(any)
属性详细信息
Array
static Array: ArrayConstructor
属性值
ArrayConstructor
继承属性详细信息
length
获取或设置数组的长度。 这是比数组中定义的最高元素更高的数字。
length: number
属性值
number
继承自 Array.length
方法详细信息
bind(DialogContext, DialogStateManager)
将数据绑定到模板。
function bind(dialogContext: DialogContext, data?: DialogStateManager): Promise<ChoiceSet>
参数
- dialogContext
-
DialogContext
DialogContext
- data
-
DialogStateManager
要绑定到的数据。
返回
Promise<ChoiceSet>
数据绑定的 ChoiceSet。
继承的方法详细信息
concat(ConcatArray<Choice>[])
合并两个或多个数组。
function concat(items: ConcatArray<Choice>[]): Choice[]
参数
- items
-
ConcatArray<Choice>[]
要添加到 array1 末尾的其他项。
返回
Choice[]
继承自 Array.concat 的
concat(T | ConcatArray<T>[])
合并两个或多个数组。
function concat(items: T | ConcatArray<T>[]): Choice[]
参数
- items
-
T | ConcatArray<T>[]
要添加到 array1 末尾的其他项。
返回
Choice[]
继承自 Array.concat 的
copyWithin(number, number, number)
在从位置目标开始到同一数组的开始和结尾复制数组部分后返回此对象
function copyWithin(target: number, start: number, end?: number): this
参数
- target
-
number
如果目标为负数,则将其视为长度+目标,其中长度是数组的长度。
- start
-
number
如果 start 为负数,则被视为 length+start。 如果结束为负数,则被视为长度+结束。
- end
-
number
如果未指定,此对象的长度将用作其默认值。
返回
this
继承自 Array.copyWithin
entries()
返回数组中每个条目的键值对的迭代值对
function entries(): IterableIterator<[number, Choice]>
返回
IterableIterator<[number, Choice]>
继承自 Array.entries
every((value: Choice, index: number, array: Choice[]) => unknown, any)
确定数组的所有成员是否满足指定的测试。
function every(callbackfn: (value: Choice, index: number, array: Choice[]) => unknown, thisArg?: any): boolean
参数
- callbackfn
-
(value: Choice, index: number, array: Choice[]) => unknown
最多接受三个参数的函数。 每个方法都会调用 array1 中每个元素的 callbackfn 函数,直到 callbackfn 返回 false,或直到数组的末尾。
- thisArg
-
any
此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。
返回
boolean
继承自 Array.every
fill(Choice, number, number)
在用值填充开头和结尾标识的节后返回此对象
function fill(value: Choice, start?: number, end?: number): this
参数
- value
-
Choice
要用
- start
-
number
要开始填充数组的索引。 如果 start 为负数,则被视为 length+start,其中长度是数组的长度。
- end
-
number
要停止填充数组的索引。 如果结束为负数,则被视为长度+结束。
返回
this
继承自 Array.fill
filter((value: Choice, index: number, array: Choice[]) => unknown, any)
返回满足回调函数中指定的条件的数组的元素。
function filter(callbackfn: (value: Choice, index: number, array: Choice[]) => unknown, thisArg?: any): Choice[]
参数
- callbackfn
-
(value: Choice, index: number, array: Choice[]) => unknown
最多接受三个参数的函数。 筛选器方法为数组中的每个元素一次调用 callbackfn 函数。
- thisArg
-
any
此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。
返回
Choice[]
继承自 Array.filter
filter<S>((value: Choice, index: number, array: Choice[]) => boolean, any)
返回满足回调函数中指定的条件的数组的元素。
function filter<S>(callbackfn: (value: Choice, index: number, array: Choice[]) => boolean, thisArg?: any): S[]
参数
- callbackfn
-
(value: Choice, index: number, array: Choice[]) => boolean
最多接受三个参数的函数。 筛选器方法为数组中的每个元素一次调用 callbackfn 函数。
- thisArg
-
any
此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。
返回
S[]
继承自 Array.filter
find((value: Choice, index: number, obj: Choice[]) => unknown, any)
function find(predicate: (value: Choice, index: number, obj: Choice[]) => unknown, thisArg?: any): Choice | undefined
参数
- predicate
-
(value: Choice, index: number, obj: Choice[]) => unknown
- thisArg
-
any
返回
Choice | undefined
继承自 Array.find
find<S>((this: void, value: Choice, index: number, obj: Choice[]) => boolean, any)
返回数组中谓词为 true 且未定义的第一个元素的值。
function find<S>(predicate: (this: void, value: Choice, index: number, obj: Choice[]) => boolean, thisArg?: any): S | undefined
参数
- predicate
-
(this: void, value: Choice, index: number, obj: Choice[]) => boolean
查找数组的每个元素的调用谓词一次(升序),直到找到谓词返回 true 的元素。 如果找到此类元素,则查找将立即返回该元素值。 否则,查找将返回未定义。
- thisArg
-
any
如果提供,它将用作每个谓词调用的此值。 如果未提供,则改用未定义。
返回
S | undefined
继承自 Array.find
findIndex((value: Choice, index: number, obj: Choice[]) => unknown, any)
返回数组中谓词为 true 的第一个元素的索引,否则 -1。
function findIndex(predicate: (value: Choice, index: number, obj: Choice[]) => unknown, thisArg?: any): number
参数
- predicate
-
(value: Choice, index: number, obj: Choice[]) => unknown
查找数组的每个元素的调用谓词一次(升序),直到找到谓词返回 true 的元素。 如果找到此类元素,findIndex 将立即返回该元素索引。 否则,findIndex 返回 -1。
- thisArg
-
any
如果提供,它将用作每个谓词调用的此值。 如果未提供,则改用未定义。
返回
number
继承自 Array.findIndex
forEach((value: Choice, index: number, array: Choice[]) => void, any)
对数组中的每个元素执行指定的操作。
function forEach(callbackfn: (value: Choice, index: number, array: Choice[]) => void, thisArg?: any)
参数
- callbackfn
-
(value: Choice, index: number, array: Choice[]) => void
最多接受三个参数的函数。 forEach 为数组中的每个元素调用一次 callbackfn 函数。
- thisArg
-
any
此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。
继承自 Array.forEach
includes(Choice, number)
确定数组是否包含特定元素,并根据需要返回 true 还是 false。
function includes(searchElement: Choice, fromIndex?: number): boolean
参数
- searchElement
-
Choice
要搜索的元素。
- fromIndex
-
number
此数组中开始搜索 searchElement 的位置。
返回
boolean
继承自 Array.includes
indexOf(Choice, number)
返回数组中值的第一个匹配项的索引。
function indexOf(searchElement: Choice, fromIndex?: number): number
参数
- searchElement
-
Choice
要在数组中查找的值。
- fromIndex
-
number
开始搜索的数组索引。 如果省略 fromIndex,则搜索从索引 0 开始。
返回
number
继承自 Array.indexOf
join(string)
添加由指定分隔符字符串分隔的数组的所有元素。
function join(separator?: string): string
参数
- separator
-
string
一个字符串,用于将数组的一个元素与生成的 String 中的下一个元素分开。 如果省略,则用逗号分隔数组元素。
返回
string
继承自 Array.join
keys()
返回数组中的键可迭代
function keys(): IterableIterator<number>
返回
IterableIterator<number>
继承自 Array.keys
lastIndexOf(Choice, number)
返回数组中指定值的最后一个匹配项的索引。
function lastIndexOf(searchElement: Choice, fromIndex?: number): number
参数
- searchElement
-
Choice
要在数组中查找的值。
- fromIndex
-
number
开始搜索的数组索引。 如果省略 fromIndex,则搜索从数组中的最后一个索引开始。
返回
number
继承自 Array.lastIndexOf
map<U>((value: Choice, index: number, array: Choice[]) => U, any)
对数组的每个元素调用定义的回调函数,并返回一个包含结果的数组。
function map<U>(callbackfn: (value: Choice, index: number, array: Choice[]) => U, thisArg?: any): U[]
参数
- callbackfn
-
(value: Choice, index: number, array: Choice[]) => U
最多接受三个参数的函数。 map 方法为数组中的每个元素调用一次 callbackfn 函数。
- thisArg
-
any
此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。
返回
U[]
继承自 Array.map
pop()
从数组中删除最后一个元素并返回它。
function pop(): Choice | undefined
返回
Choice | undefined
继承自 Array.pop
push(Choice[])
将新元素追加到数组,并返回数组的新长度。
function push(items: Choice[]): number
参数
- items
-
Choice[]
数组的新元素。
返回
number
继承自 Array.push
reduce((previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice)
为数组中的所有元素调用指定的回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。
function reduce(callbackfn: (previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice): Choice
参数
- callbackfn
-
(previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice
最多接受四个参数的函数。 reduce 方法每次调用数组中每个元素的 callbackfn 函数。
返回
Choice
继承自 Array.reduce
reduce((previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice, Choice)
function reduce(callbackfn: (previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice, initialValue: Choice): Choice
参数
- callbackfn
-
(previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice
- initialValue
-
Choice
返回
Choice
继承自 Array.reduce
reduce<U>((previousValue: U, currentValue: Choice, currentIndex: number, array: Choice[]) => U, U)
为数组中的所有元素调用指定的回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。
function reduce<U>(callbackfn: (previousValue: U, currentValue: Choice, currentIndex: number, array: Choice[]) => U, initialValue: U): U
参数
- callbackfn
-
(previousValue: U, currentValue: Choice, currentIndex: number, array: Choice[]) => U
最多接受四个参数的函数。 reduce 方法每次调用数组中每个元素的 callbackfn 函数。
- initialValue
-
U
如果指定 initialValue,则将其用作启动累积的初始值。 对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。
返回
U
继承自 Array.reduce
reduceRight((previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice)
按降序调用数组中所有元素的指定回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。
function reduceRight(callbackfn: (previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice): Choice
参数
- callbackfn
-
(previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice
最多接受四个参数的函数。 reduceRight 方法为数组中的每个元素调用回调fn 函数一次。
返回
Choice
继承自 Array.reduceRight
reduceRight((previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice, Choice)
function reduceRight(callbackfn: (previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice, initialValue: Choice): Choice
参数
- callbackfn
-
(previousValue: Choice, currentValue: Choice, currentIndex: number, array: Choice[]) => Choice
- initialValue
-
Choice
返回
Choice
继承自 Array.reduceRight
reduceRight<U>((previousValue: U, currentValue: Choice, currentIndex: number, array: Choice[]) => U, U)
按降序调用数组中所有元素的指定回调函数。 回调函数的返回值是累积的结果,并在下一次调用回调函数时作为参数提供。
function reduceRight<U>(callbackfn: (previousValue: U, currentValue: Choice, currentIndex: number, array: Choice[]) => U, initialValue: U): U
参数
- callbackfn
-
(previousValue: U, currentValue: Choice, currentIndex: number, array: Choice[]) => U
最多接受四个参数的函数。 reduceRight 方法为数组中的每个元素调用回调fn 函数一次。
- initialValue
-
U
如果指定 initialValue,则将其用作启动累积的初始值。 对 callbackfn 函数的第一次调用将此值作为参数而不是数组值提供。
返回
U
继承自 Array.reduceRight
reverse()
反转数组中的元素。
function reverse(): Choice[]
返回
Choice[]
继承自 Array.reverse
shift()
从数组中删除第一个元素并返回它。
function shift(): Choice | undefined
返回
Choice | undefined
继承自 Array.shift
slice(number, number)
返回数组的一部分。
function slice(start?: number, end?: number): Choice[]
参数
- start
-
number
数组的指定部分的开头。
- end
-
number
数组指定部分的末尾。
返回
Choice[]
继承自 Array.slice
some((value: Choice, index: number, array: Choice[]) => unknown, any)
确定指定的回调函数是否为数组的任何元素返回 true。
function some(callbackfn: (value: Choice, index: number, array: Choice[]) => unknown, thisArg?: any): boolean
参数
- callbackfn
-
(value: Choice, index: number, array: Choice[]) => unknown
最多接受三个参数的函数。 某些方法调用 array1 中每个元素的 callbackfn 函数,直到 callbackfn 返回 true,或直到数组的末尾。
- thisArg
-
any
此关键字可以在 callbackfn 函数中引用的对象。 如果省略 thisArg,则未定义将用作此值。
返回
boolean
继承自 Array.some
sort((a: Choice, b: Choice) => number)
对数组进行排序。
function sort(compareFn?: (a: Choice, b: Choice) => number): this
参数
- compareFn
-
(a: Choice, b: Choice) => number
用于确定元素顺序的函数的名称。 如果省略,则按升序 ASCII 字符顺序对元素进行排序。
返回
this
继承自 Array.sort
splice(number, number)
从数组中删除元素,并在必要时在其位置插入新元素,并返回已删除的元素。
function splice(start: number, deleteCount?: number): Choice[]
参数
- start
-
number
数组中从零开始删除元素的位置。
- deleteCount
-
number
要移除的元素数。
返回
Choice[]
继承自 Array.splice
splice(number, number, Choice[])
从数组中删除元素,并在必要时在其位置插入新元素,并返回已删除的元素。
function splice(start: number, deleteCount: number, items: Choice[]): Choice[]
参数
- start
-
number
数组中从零开始删除元素的位置。
- deleteCount
-
number
要移除的元素数。
- items
-
Choice[]
要插入数组中的元素代替已删除的元素。
返回
Choice[]
继承自 Array.splice
toLocaleString()
返回数组的字符串表示形式。 元素使用其 toLocalString 方法转换为字符串。
function toLocaleString(): string
返回
string
继承自 Array.toLocaleString
toString()
返回数组的字符串表示形式。
function toString(): string
返回
string
继承自 Array.toString
unshift(Choice[])
在数组的开头插入新元素。
function unshift(items: Choice[]): number
参数
- items
-
Choice[]
要插入到数组开头的元素。
返回
number
继承自 Array.unshift
values()
返回数组中值的可迭代值
function values(): IterableIterator<Choice>
返回
IterableIterator<Choice>
继承自 Array.values