Skip to content

Commit

Permalink
Add inputs option to runQuery method
Browse files Browse the repository at this point in the history
Closes artpi#16.
  • Loading branch information
d4hines committed Dec 8, 2021
1 parent 0fe3579 commit 2af9785
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions RoamPrivateApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ class RoamPrivateApi {
* More about the query syntax: https://www.zsolt.blog/2021/01/Roam-Data-Structure-Query.html
* @param {string} query - datalog query.
*/
async runQuery( query ) {
async runQuery( query, inputs) {
return await this.page.evaluate( ( query ) => {
if ( ! window.roamAlphaAPI ) {
return Promise.reject( 'No Roam API detected' );
}
const result = window.roamAlphaAPI.q( query );
const result = inputs === undefined ?
window.roamAlphaAPI.q( query )
: window.roamAlphaAPI.q( query, inputs );
console.log( result );
return Promise.resolve( result );
}, query );
Expand Down

0 comments on commit 2af9785

Please sign in to comment.