LIB_Cbb.modify() 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.
Modify Reuse block
Signature
typescript
function modify(
cbbUuid: string,
libraryUuid: string,
cbbName?: string,
classification?: ILIB_ClassificationIndex | Array<string> | null,
description?: string | null,
): Promise<boolean>;1
2
3
4
5
6
7
2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
cbbUuid | string | Reuse block UUID |
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
cbbName | string | (Optional) Reuse block name |
classification | ILIB_ClassificationIndex | Array<string> | null | (Optional) Classification |
description | string | null | (Optional) Description |
Returns
Promise<boolean>
Whether the operation is successful
Remarks
If you want to clear certain properties, set their values to null
Example
javascript
// 1. 获取系统库与个人库 UUID
const systemLib = await eda.lib_LibrariesList.getSystemLibraryUuid();
const personalLib = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 复制一个系统库模块到个人库作为修改对象
const results = await eda.lib_Cbb.search('', systemLib, undefined, 1);
const source = results[0];
const cbbUuid = await eda.lib_Cbb.copy(source.uuid, systemLib, personalLib, [], `嘉立创示例_修改_${Date.now()}`);
// 3. 修改名称和描述(分类保持不变传 [])
const newName = `嘉立创示例_重命名_${Date.now()}`;
const modified = await eda.lib_Cbb.modify(cbbUuid, personalLib, newName, [], '修改后的描述');
// 修改类保留现场
console.log('cbbUuid:', cbbUuid);
console.log('modified:', modified);
console.log('newName:', newName);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18