成员 Members
readonly dataSourceAdded : Event
将数据源添加到集合时引发的事件。事件处理程序将传递添加的数据源。 An event that is raised when a data source is added to the collection. Event handlers are passed the data source that was added.
readonly dataSourceMoved : Event
当数据源更改集合中的位置时引发的事件。向事件处理程序传递已移动的数据源、移动后的新索引以及移动前的旧索引。 An event that is raised when a data source changes position in the collection. Event handlers are passed the data source that was moved, its new index after the move, and its old index prior to the move.
readonly dataSourceRemoved : Event
从集合中删除数据源时引发的事件。事件处理程序将传递已删除的数据源。 An event that is raised when a data source is removed from the collection. Event handlers are passed the data source that was removed.
获取此集合中数据源的数量。 Gets the number of data sources in this collection.
方法 Methods
add(dataSource) → Promise.<DataSource>
将数据源添加到集合中。 Adds a data source to the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | Promise.<DataSource> | 数据源或对要添加到集合中的数据源的承诺。传递 Promise 时,在 Promise 成功解析之前,数据源实际上不会添加到集合中。 A data source or a promise to a data source to add to the collection. When passing a promise, the data source will not actually be added to the collection until the promise resolves successfully. |
返回: Returns:
一旦数据源添加到集合中,就会解析的 Promise。 A Promise that resolves once the data source has been added to the collection.
检查集合是否包含给定的数据源。 Checks to see if the collection contains a given data source.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | 要检查的数据源。 The data source to check for. |
返回: Returns:
如果集合包含数据源,则为 true,否则为 false。 true if the collection contains the data source, false otherwise.
销毁该集合中所有数据源所持有的资源。显式销毁此对象可以确定性地释放 WebGL 资源,而不是依赖垃圾收集器。一旦该对象被销毁,就不应再使用;调用除 Destroys the resources held by all data sources in this collection. Explicitly destroying this object allows for deterministic release of WebGL resources, instead of relying on the garbage collector. Once this object is destroyed, it should not be used; calling any function other than
isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.
抛出: Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
示例: Example:
dataSourceCollection = dataSourceCollection && dataSourceCollection.destroy();
另见: See:
从集合中按索引获取数据源。 Gets a data source by index from the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
index |
number | 要检索的索引。 the index to retrieve. |
返回: Returns:
指定索引处的数据源。 The data source at the specified index.
getByName(name) → Array.<DataSource>
从集合中按名称获取数据源。 Gets a data source by name from the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
name |
string | 要检索的名称。 The name to retrieve. |
返回: Returns:
与提供的名称匹配的所有数据源的列表。 A list of all data sources matching the provided name.
确定集合中给定数据源的索引。 Determines the index of a given data source in the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | 要查找其索引的数据源。 The data source to find the index of. |
返回: Returns:
集合中数据源的索引,如果集合中不存在数据源,则为 -1。 The index of the data source in the collection, or -1 if the data source does not exist in the collection.
如果该对象被销毁则返回 true;否则为假。如果该对象被破坏,则不应使用它;调用除 Returns true if this object was destroyed; otherwise, false. If this object was destroyed, it should not be used; calling any function other than
isDestroyed 将导致 will result in a DeveloperError exception.
返回: Returns:
如果该对象被销毁,则为 true;否则为假。 true if this object was destroyed; otherwise, false.
另见: See:
将数据源在集合中降低一位。 Lowers a data source down one position in the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | 要移动的数据源。 The data source to move. |
抛出: Throws:
-
DeveloperError : 数据源不在此集合中。 : dataSource is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
将数据源降低到集合的底部。 Lowers a data source to the bottom of the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | 要移动的数据源。 The data source to move. |
抛出: Throws:
-
DeveloperError : 数据源不在此集合中。 : dataSource is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
将数据源在集合中的位置提升一位。 Raises a data source up one position in the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | 要移动的数据源。 The data source to move. |
抛出: Throws:
-
DeveloperError : 数据源不在此集合中。 : dataSource is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
将数据源提升到集合的顶部。 Raises a data source to the top of the collection.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
dataSource |
DataSource | 要移动的数据源。 The data source to move. |
抛出: Throws:
-
DeveloperError : 数据源不在此集合中。 : dataSource is not in this collection.
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
从此集合中删除数据源(如果存在)。 Removes a data source from this collection, if present.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
dataSource |
DataSource | 要删除的数据源。 The data source to remove. | |
destroy |
boolean |
false
|
可选 optional 除了删除数据源之外是否还销毁数据源。 Whether to destroy the data source in addition to removing it. |
返回: Returns:
如果数据源位于集合中并已被删除,则为 true;如果数据源不在集合中,则为 false。 true if the data source was in the collection and was removed, false if the data source was not in the collection.
从此集合中删除所有数据源。 Removes all data sources from this collection.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
destroy |
boolean |
false
|
可选 optional 除了删除数据源之外是否还销毁它们。 whether to destroy the data sources in addition to removing them. |
