mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-28 09:25:50 +08:00
fixed chrome.webRequest.RequestFilter.types
This commit is contained in:
@@ -152,4 +152,25 @@ function printPage() {
|
||||
var action_url = "javascript:window.print();";
|
||||
chrome.tabs.update(tab.id, { url: action_url });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.chrome.com/extensions/examples/extensions/catblock/background.js
|
||||
function catBlock () {
|
||||
var loldogs: string[];
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function(info) {
|
||||
console.log("Cat intercepted: " + info.url);
|
||||
// Redirect the lolcal request to a random loldog URL.
|
||||
var i = Math.round(Math.random() * loldogs.length);
|
||||
return {redirectUrl: loldogs[i]};
|
||||
},
|
||||
// filters
|
||||
{
|
||||
urls: [
|
||||
"https://i.chzbgr.com/*"
|
||||
],
|
||||
types: ["image"]
|
||||
},
|
||||
// extraInfoSpec
|
||||
["blocking"]);
|
||||
}
|
||||
|
||||
2
chrome/chrome.d.ts
vendored
2
chrome/chrome.d.ts
vendored
@@ -2248,7 +2248,7 @@ declare module chrome.webRequest {
|
||||
|
||||
interface RequestFilter {
|
||||
tabId?: number;
|
||||
types?: string;
|
||||
types?: string[];
|
||||
urls: string[];
|
||||
windowId?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user