Plugin API
English
搜索
K

Modify Data

You can directly modify the results obtained using the Eagle Plugin API method. To save the modified results, just call the save() method of the result object. Here are some simple examples:

Example 1: Modify the selected file of the current application

// Get the currently selected file in the Eagle app
let items = await eagle.item.getSelected();
let item = items[0];
// Modify tags
item.tags = ['tag1', 'tag2'];
// Save changes
await item.save();

Example 2: Modify folder properties

// Get the currently selected folder in the Eagle app
let folder = (await eagle.folder.getSelected())[0];
// Modify properties
folder.name = 'New Folder Name';
folder.description = 'New description...';
// Save changes
await folder.save();
🦄 Best Practice: To ensure data security, use the API-provided save() method for data access and modification, and avoid directly modifying any files under the Eagle resource library.