Skip to content

Commit

Permalink
Added support for Google Chrome Notification API
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Safiullin authored and Vadim Safiullin committed Jun 10, 2014
1 parent 4350242 commit 1864331
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions chrome/chrome.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,68 @@ declare module chrome.management {
var onEnabled: ManagementEnabledEvent;
}

////////////////////
// Notifications
// https://developer.chrome.com/extensions/notifications
////////////////////
declare module chrome.notifications {
interface ButtonOptions {
title: string;
iconUrl?: string;
}

interface ItemOptions {
title: string;
message: string;
}

interface NotificationOptions {
type?: string;
iconUrl?: string;
title?: string;
message?: string;
contextMessage?: string;
priority?: number;
eventTime?: number;
buttons?: Array<ButtonOptions>;
items?: Array<ItemOptions>;
progress?: number;
isClickable?: boolean;
}

interface OnClosed {
addListener(callback: (notificationId: string, byUser: boolean) => void): void;
}

interface OnClicked {
addListener(callback: (notificationId: string) => void): void;
}

interface OnButtonClicked {
addListener(callback: (notificationId: string, buttonIndex: number) => void): void;
}

interface OnPermissionLevelChanged {
addListener(callback: (level: string) => void): void;
}

interface OnShowSettings {
addListener(callback: Function): void;
}

export var onClosed: OnClosed;
export var onClicked: OnClicked;
export var onButtonClicked: OnButtonClicked;
export var onPermissionLevelChanged: OnPermissionLevelChanged;
export var onShowSettings: OnShowSettings;

export function create(notificationId: string, options: NotificationOptions, callback: (notificationId: string) => void): void;
export function update(notificationId: string, options: NotificationOptions, callback: (wasUpdated: boolean) => void): void;
export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void;
export function getAll(callback: (notifications: any) => void): void;
export function getPermissionLevel(callback: (level: string) => void): void;
}

////////////////////
// Omnibox
////////////////////
Expand Down

0 comments on commit 1864331

Please sign in to comment.