Home > LIB_Device > search
LIB_Device.search() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Search device
Signature
typescript
function search(
key: string,
libraryUuid?: string,
classification?: ILIB_ClassificationIndex | Array<string>,
symbolType?: ELIB_SymbolType,
itemsOfPage?: number,
page?: number,
): Promise<Array<ILIB_DeviceSearchItem>>;1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Parameters
Parameter | Type | Description |
|---|---|---|
key | string | Search keyword |
libraryUuid | string | (Optional) Library UUID, default is system library, you can use LIB_LibrariesList APIs in |
classification | ILIB_ClassificationIndex | Array<string> | (Optional) Classification, defaults to all |
symbolType | (Optional) Symbol type, defaults to all | |
itemsOfPage | number | (Optional) Number of search results per page |
page | number | (Optional) Page count |
Returns
Promise<Array<ILIB_DeviceSearchItem>>
List of searched device properties
Example
javascript
// 1. 按关键字搜索系统库中的器件,每页 5 条
const results = await eda.lib_Device.search('0402', undefined, undefined, undefined, 5, 1);
// 2. 输出搜索结果
console.log('count:', results.length);
results.forEach((item, i) => {
console.log(`[${i}] name:`, item.name, 'uuid:', item.uuid, 'supplierId:', item.supplierId);
});1
2
3
4
5
6
7
8
2
3
4
5
6
7
8