本文整理匯總了TypeScript中phosphor/lib/collections/vector.Vector.set方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Vector.set方法的具體用法?TypeScript Vector.set怎麽用?TypeScript Vector.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phosphor/lib/collections/vector.Vector
的用法示例。
在下文中一共展示了Vector.set方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setItem
/**
* Set the item at a specific index in the list.
*
* @param index - The index of interest. This must be an integer in
* the range `[0, internal.length)`.
*
* @param item - The item to set at the index.
*
* @returns The item which previously occupied the specified index.
*
* #### Notes
* This may be reimplemented by subclasses to customize the behavior.
*/
protected setItem(index: number, item: T): T {
let old = this.internal.at(index);
this.internal.set(index, item);
this.changed.emit({
type: 'set',
newIndex: index,
newValue: item,
oldIndex: index,
oldValue: old,
});
return old;
}