item(項目)
透過 eagle.item API 可以方便的查詢當前資源庫內容或新增新的內容到資源庫中。
eagle.onPluginCreate(async (plugin) => {
// 取得 Eagle 應用當前被選中的檔案
let items = await eagle.item.getSelected();
let item = items[0];
// 修改屬性
item.name = 'New Name';
item.tags = ['tag1', 'tag2'];
// 儲存修改
await item.save();
});方法
get(options)
getAll()
getById(itemId)
getByIds(itemIds)
getIdsWithModifiedAt()
getSelected()
count(options)
countAll()
countSelected()
select(itemIds)
addFromURL(url, options)
addFromBase64(base64, options)
addFromPath(path, options)
addBookmark(url, options)
open(itemId, options)
類:Item
實例方法
save()
moveToTrash()
replaceFile(filePath)
refreshThumbnail()
setCustomThumbnail(thumbnailPath)
addComment(commentData) (Eagle 4.0 build22+)
updateComment(commentId, updateData) (Eagle 4.0 build22+)
removeComment(commentId) (Eagle 4.0 build22+)
open(options)
select()
實例屬性
id string
name string
ext string
width Interger
height Interger
url string
isDeleted boolean
annotation string
tags string[]
folders string[]
palettes Object[]
comments Object[] (Eagle 4.0 build22+)
size Interger
star Interger
importedAt Interger
modifiedAt Interger
noThumbnail boolean
noPreview boolean
filePath string
fileURL string
thumbnailPath string
thumbnailURL string
metadataFilePathstring
Last updated