mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Added/Updated omnibox /w docs
This commit is contained in:
40
chrome/chrome.d.ts
vendored
40
chrome/chrome.d.ts
vendored
@@ -4837,37 +4837,73 @@ declare module chrome.notifications {
|
||||
////////////////////
|
||||
// Omnibox
|
||||
////////////////////
|
||||
/**
|
||||
* The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.
|
||||
* Manifest: "omnibox": {...}
|
||||
* @since Chrome 9.
|
||||
*/
|
||||
declare module chrome.omnibox {
|
||||
/** A suggest result. */
|
||||
interface SuggestResult {
|
||||
/** The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry. */
|
||||
content: string;
|
||||
/** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 */
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface Suggestion {
|
||||
/** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. */
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface OmniboxInputEnteredEvent extends chrome.events.Event {
|
||||
/**
|
||||
* The callback parameter should be a function that looks like this:
|
||||
* function(string text, OnInputEnteredDisposition disposition) {...};
|
||||
*/
|
||||
addListener(callback: (text: string) => void): void;
|
||||
}
|
||||
|
||||
interface OmniboxInputChangedEvent extends chrome.events.Event {
|
||||
/**
|
||||
* The callback parameter should be a function that looks like this:
|
||||
* function(string text, function suggest) {...};
|
||||
* Parameter suggest: A callback passed to the onInputChanged event used for sending suggestions back to the browser.
|
||||
* The suggest parameter should be a function that looks like this:
|
||||
* function(array of SuggestResult suggestResults) {...};
|
||||
*/
|
||||
addListener(callback: (text: string, suggest: (suggestResults: SuggestResult[]) => void) => void): void;
|
||||
}
|
||||
|
||||
interface OmniboxInputStartedEvent extends chrome.events.Event {
|
||||
addListener(callback: Function): void;
|
||||
/**
|
||||
* The callback parameter should be a function that looks like this:
|
||||
* function() {...};
|
||||
*/
|
||||
addListener(callback: () => void): void;
|
||||
}
|
||||
|
||||
interface OmniboxInputCancelledEvent extends chrome.events.Event {
|
||||
addListener(callback: Function): void;
|
||||
/**
|
||||
* The callback parameter should be a function that looks like this:
|
||||
* function() {...};
|
||||
*/
|
||||
addListener(callback: () => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar.
|
||||
* @param suggestion A partial SuggestResult object, without the 'content' parameter.
|
||||
*/
|
||||
export function setDefaultSuggestion(suggestion: Suggestion): void;
|
||||
|
||||
/** User has accepted what is typed into the omnibox. */
|
||||
var onInputEntered: OmniboxInputEnteredEvent;
|
||||
/** User has changed what is typed into the omnibox. */
|
||||
var onInputChanged: OmniboxInputChangedEvent;
|
||||
/** User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events. */
|
||||
var onInputStarted: OmniboxInputStartedEvent;
|
||||
/** User has ended the keyword input session without accepting the input. */
|
||||
var onInputCancelled: OmniboxInputCancelledEvent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user