Update chrome.js

This commit is contained in:
Namhyeon Go 2021-11-18 13:58:18 +09:00 committed by GitHub
parent e891f3d1dc
commit e8e08c5a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -297,12 +297,34 @@ var ChromeObject = function() {
});
};
this.getPagesByUrls = function(urls) {
return this.getPageList().reduce(function(acc, x) {
for (var i = 0; i < urls.length; i++) {
if (x.url.indexOf(urls[i]) == 0) {
acc.push(x);
}
}
return acc;
}, []);
};
this.getPagesByTitle = function(title) {
return this.getPageList().filter(function(x) {
return (x.title.indexOf(title) == 0);
});
};
this.getPagesByTitles = function(titles) {
return this.getPageList().reduce(function(acc, x) {
for (var i = 0; i < titles.length; i++) {
if (x.title.indexOf(titles[i]) == 0) {
acc.push(x);
}
}
return acc;
}, []);
};
this.sendPageRPC = function(method, params) {
var result = null;