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)
getSelected()
getIdsWithModifiedAt()
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
最后更新于