scrollToBottom option

This commit is contained in:
2020-01-11 20:00:52 +08:00
parent 0cf04c3f79
commit 341abebc66
5 changed files with 150 additions and 69 deletions

View File

@ -136,6 +136,19 @@ function queryUrl(tab, expected, log) {
return sendMessage(tab, req, log, cond);
}
/**
* get the url of the target tab
* @param {any} tab target tab
* @param {string} expected if specified, queryUrl resolves only when tab url equals to expected
* @returns {Promise<string>} a promise of the url
*/
function scrollToBottom(tab) {
let req = {
action: ACTION_SCROLL_BOTTOM
}
return sendMessage(tab, req, 'Scroll to page bottom...');
}
async function createTab(url, active) {
return new Promise((resolve, reject) => {
chrome.tabs.create({