From 2af9785b574d1bd79a21120ebeeeeedab7f5b5b4 Mon Sep 17 00:00:00 2001 From: Daniel Hines Date: Wed, 8 Dec 2021 15:26:16 -0500 Subject: [PATCH] Add inputs option to runQuery method Closes #16. --- RoamPrivateApi.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RoamPrivateApi.js b/RoamPrivateApi.js index 518ac2c..a975441 100644 --- a/RoamPrivateApi.js +++ b/RoamPrivateApi.js @@ -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 );