This must have been asked before, I am just not sure exactly what to search for, I can delete the question if someone links to a duplicate! Thanks.
If I have a javascript function which calls an external api, how can I pass other parameters before the data is returned? E.g. using Google Apps, the tasks api returns a list of the user's tasks like so:
google.script.run
    .withSuccessHandler(showTasks) // showTasks callback function
    .getTasks(taskListId);
}
/* Show the returned tasks on the page. */
function showTasks(tasks) {
    // tasks is now an object of tasks returned by google
    ...
However, I want to do this:
var tasksListNumber = 1;  
google.script.run
    .withSuccessHandler(showTasks(null, tasksListNumber)) // showTasks callback function
    .getTasks(taskListId);
}
/* Show the returned tasks on the page. */
function showTasks(tasks, tasksListNumber) {
    // tasks is now an object of tasks returned by google
    // tasksListNumber is 1
    ...
Does the solution involve using the bind function somehow?