I made small but substantial modification: await
before eval.
This allows to have results from Promises.
Like, how to get data from joplin
package, for example:
joplin.data.get(['search'], { query:"test",fields: ['id', 'title','body'] }).then(res => JSON.stringify(res, null,2))
Executing this inside a note with Eval plugin will return JSON with notes that normally would be returned by search for query test
.
{
"items": [
{
"id": "02400acada214e099bb8124e28d337f1",
"title": "test js",
"type_": 1
},
{
"id": "938624431fb44b9e92fdef50dd5cc40e",
"title": "test",
"type_": 1
}
{
"id": "749cbde2bcc441f08de95ef2103c81a1",
"title": "22/12/2020 14:29",
"type_": 1
},
{
"id": "f6662116a8704c9cb47fb903b4a4e2fd",
"title": "Auto related notes next under this note",
"type_": 1
},
],
"has_more": false
}
(i omitted body in this json for brevity )