I can pass the function the pageCount from my REST API meta section. I’d like to pass the query params to the function too. I can get them by reading the window url in javascript, but it would be cleaner to get them in the function call. Is there a way to pass more than one parameter to the function “data”?
What I want to do, can’t figure out is something like this:
function('pagination', get('query').get('p'))
The pagination function is passed a data variable with one value from get(‘pageCount’). I want to pass it two variables.
Inside of the pagination function, the first line looks like this:
let pageCount = data.value;
// I want it to look more like this:
let pageCount = data.value.pageCount;
let currentPage = data.value.currentPage;
My current approach is to bake this into the top of the function, and it feels like there is a better way:
Currently nesting functions is not possible, but we left the window open for the implementation in future.
What you can do for now, is use Divhunt built-in functions.
$dh.query() returns an object with all GET params (this is what you need)
$dh.site() returns object of site data like ID, name, etc
$dh.domain() returns domain data, etc
$dh.client() returns client data (Divhunt client, not your website client)
$dh.language() returns language data