diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts new file mode 100644 index 000000000..c8dd2e6d4 --- /dev/null +++ b/chrome/chrome-app.d.ts @@ -0,0 +1,95 @@ +// Type definitions for Chrome packaged application development. +// Project: http://developer.chrome.com/apps/ +// Definitions by: Adam Lay +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +//////////////////// +// App Runtime +//////////////////// +declare module chrome.app.runtime { + interface LaunchData { + id?: string; + items?: LaunchDataItem[]; + url?: string; + referrerUrl?: string; + isKioskSession?: boolean; + } + + interface LaunchDataItem { + entry: File; + type: string; + } + + interface LaunchedEvent { + addListener(callback: (launchData: LaunchData) => void); + } + + interface RestartedEvent { + addListener(callback: () => void); + } + + var onLaunched: LaunchedEvent; + var onRestarted: RestartedEvent; +} + +//////////////////// +// App Window +//////////////////// +declare module chrome.app.window { + interface Bounds { + left?: number; + top?: number; + width?: number; + height?: number; + } + + interface AppWindow { + focus: () => void; + fullscreen: () => void; + isFullscreen: () => boolean; + minimize: () => void; + isMinimized: () => boolean; + maximize: () => void; + isMaximized: () => boolean; + restore: () => void; + moveTo: (left: number, top: number) => void; + resizeTo: (width: number, height: number) => void; + drawAttention: () => void; + clearAttention: () => void; + close: () => void; + show: () => void; + hide: () => void; + getBounds: () => Bounds; + setBounds: (bounds: Bounds) => void; + contentWindow: Window; + } + + interface CreateOptions { + id?: string; + minWidth?: number; + minHeight?: number; + maxWidth?: number; + maxHeight?: number; + frame?: string; // "none", "chrome" + bounds?: Bounds; + transparentBackground?: boolean; + state?: string; // "normal", "fullscreen", "maximized", "minimized" + hidden?: boolean; + resizable?: boolean; + singleton?: boolean; + } + + export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void; + export function current(): AppWindow; + + interface WindowEvent { + addListener(callback: () => void): void; + } + + var onBoundsChanged: WindowEvent; + var onClosed: WindowEvent; + var onFullscreened: WindowEvent; + var onMaximized: WindowEvent; + var onMinimized: WindowEvent; + var onRestored: WindowEvent; +} \ No newline at end of file diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 1aa91a2de..3a01db6c1 100644 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2,8 +2,6 @@ // Project: http://developer.chrome.com/extensions/ // Definitions by: Matthew Kimber // Definitions: https://github.com/borisyankov/DefinitelyTyped -// Chrome App: http://developer.chrome.com/apps/api_index.html -// Definitions: Adam Lay //////////////////// // Alarms @@ -36,97 +34,6 @@ declare module chrome.alarms { var onAlarm: AlarmEvent; } -//////////////////// -// App Runtime -//////////////////// -declare module chrome.app.runtime { - interface LaunchData { - id?: string; - items?: LaunchDataItem[]; - url?: string; - referrerUrl?: string; - isKioskSession?: boolean; - } - - interface LaunchDataItem { - entry: File; - type: string; - } - - interface LaunchedEvent { - addListener(callback: (launchData: LaunchData) => void); - } - - interface RestartedEvent { - addListener(callback: () => void); - } - - var onLaunched: LaunchedEvent; - var onRestarted: RestartedEvent; -} - -//////////////////// -// App Window -//////////////////// -declare module chrome.app.window { - interface Bounds { - left?: number; - top?: number; - width?: number; - height?: number; - } - - interface AppWindow { - focus: () => void; - fullscreen: () => void; - isFullscreen: () => boolean; - minimize: () => void; - isMinimized: () => boolean; - maximize: () => void; - isMaximized: () => boolean; - restore: () => void; - moveTo: (left: number, top: number) => void; - resizeTo: (width: number, height: number) => void; - drawAttention: () => void; - clearAttention: () => void; - close: () => void; - show: () => void; - hide: () => void; - getBounds: () => Bounds; - setBounds: (bounds: Bounds) => void; - contentWindow: Window; - } - - interface CreateOptions { - id?: string; - minWidth?: number; - minHeight?: number; - maxWidth?: number; - maxHeight?: number; - frame?: string; // "none", "chrome" - bounds?: Bounds; - transparentBackground?: boolean; - state?: string; // "normal", "fullscreen", "maximized", "minimized" - hidden?: boolean; - resizable?: boolean; - singleton?: boolean; - } - - export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void; - export function current(): AppWindow; - - interface WindowEvent { - addListener(callback: () => void): void; - } - - var onBoundsChanged: WindowEvent; - var onClosed: WindowEvent; - var onFullscreened: WindowEvent; - var onMaximized: WindowEvent; - var onMinimized: WindowEvent; - var onRestored: WindowEvent; -} - //////////////////// // Bookmarks ////////////////////