ChoiceSet class
定義 ChoiceSet 集合。
- Extends
-
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
如果 target 是負數,則會將它視為 length+target,其中 length 是陣列的長度。
- start
-
number
如果 start 為負數,則會將其視為 length+start。 如果 end 為負數,則會將其視為 length+end。
- 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,則會使用 undefined 作為此值。
傳回
boolean
繼承自 Array.every
fill(Choice, number, number)
以值填滿開頭和結尾所識別的區段之後,傳回這個物件
function fill(value: Choice, start?: number, end?: number): this
參數
- value
-
Choice
要填入數位區段的值
- start
-
number
要開始填入陣列的索引。 如果 start 為負數,則會將它視為 length+start,其中 length 是陣列的長度。
- end
-
number
要停止填滿陣列的索引。 如果 end 為負數,則會將其視為 length+end。
傳回
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,則會使用 undefined 作為此值。
傳回
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,則會使用 undefined 作為此值。
傳回
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
find 會以遞增順序針對數位的每個元素呼叫述詞一次,直到找到述詞傳回 true 的元素為止。 如果找到這類項目,尋找會立即傳回該專案值。 否則,find 會傳回未定義。
- 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
find 會以遞增順序針對數位的每個元素呼叫述詞一次,直到找到述詞傳回 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,則會使用 undefined 作為此值。
繼承自 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,則會使用 undefined 作為此值。
傳回
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 方法會針對數位中的每個元素呼叫 callbackfn 函式一次。
傳回
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 方法會針對數位中的每個元素呼叫 callbackfn 函式一次。
- initialValue
-
U
如果指定 initialValue,則會用來做為開始累積的初始值。 第一次呼叫 callbackfn 函式會提供此值做為自變數,而不是數位值。
傳回
U
繼承自 Array.reduceRight
reverse()
反轉Array中的專案。
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,則會使用 undefined 作為此值。
傳回
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