mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #4082 from jpevarnek/chrome-settings-fix
Update chrome settings interface
This commit is contained in:
@@ -174,3 +174,26 @@ function catBlock () {
|
||||
// extraInfoSpec
|
||||
["blocking"]);
|
||||
}
|
||||
|
||||
// contrived settings example
|
||||
function proxySettings() {
|
||||
chrome.proxy.settings.get({ incognito: false }, (details) => {
|
||||
var val = details.value;
|
||||
var level: string = details.levelOfControl;
|
||||
var incognito: boolean = details.incognitoSpecific;
|
||||
});
|
||||
|
||||
// bare minimum set call
|
||||
chrome.proxy.settings.set({ value: 'something' });
|
||||
|
||||
// add a scope and callback
|
||||
chrome.proxy.settings.set({
|
||||
value: 'something',
|
||||
scope: 'regular'
|
||||
}, () => {});
|
||||
|
||||
chrome.proxy.settings.clear({});
|
||||
|
||||
// clear with a scope set
|
||||
chrome.proxy.settings.clear({ scope: 'regular' });
|
||||
}
|
||||
|
||||
Vendored
+9
-3
@@ -2061,8 +2061,11 @@ declare module chrome.ttsEngine {
|
||||
// Types
|
||||
////////////////////
|
||||
declare module chrome.types {
|
||||
interface ChromeSettingSetDetails {
|
||||
interface ChromeSettingClearDetails {
|
||||
scope?: string;
|
||||
}
|
||||
|
||||
interface ChromeSettingSetDetails extends ChromeSettingClearDetails {
|
||||
value: any;
|
||||
}
|
||||
|
||||
@@ -2070,6 +2073,8 @@ declare module chrome.types {
|
||||
incognito?: boolean;
|
||||
}
|
||||
|
||||
type DetailsCallback = (details: ChromeSettingGetResultDetails) => void;
|
||||
|
||||
interface ChromeSettingGetResultDetails {
|
||||
levelOfControl: string;
|
||||
value: any;
|
||||
@@ -2077,7 +2082,7 @@ declare module chrome.types {
|
||||
}
|
||||
|
||||
interface ChromeSettingChangedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: ChromeSettingGetResultDetails) => void): void;
|
||||
addListener(callback: DetailsCallback): void;
|
||||
}
|
||||
|
||||
interface ChromeSetting {
|
||||
@@ -2086,7 +2091,8 @@ declare module chrome.types {
|
||||
callback?: Function;
|
||||
};
|
||||
set(details: ChromeSettingSetDetails, callback?: Function): void;
|
||||
get(details: ChromeSettingGetDetails, callback?: ChromeSettingGetResultDetails): void;
|
||||
get(details: ChromeSettingGetDetails, callback?: DetailsCallback): void;
|
||||
clear(details: ChromeSettingClearDetails, callback?: Function): void;
|
||||
onChange: ChromeSettingChangedEvent;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user