Merge branch 'chrome-updates' of github.com:niikoo/DefinitelyTyped into chrome-updates

This commit is contained in:
Nikolai Ommundsen
2018-08-24 11:57:39 +02:00
6 changed files with 3301 additions and 850 deletions
+47
View File
@@ -0,0 +1,47 @@
// Type definitions for Chrome packaged application development
// Project: http://developer.chrome.com/apps/
// Definitions by: Nikolai Ommundsen <https://github.com/niikoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/////////////////
// AppView Tag //
/////////////////
/**
* Use the appview tag to embed other Chrome Apps within your Chrome App.
* The appview runs in a separate process from your app,
* it doesn't inherit the same permissions and is only allowed
* to interact with your app through asynchronous APIs.
* Not all apps can be embedded; apps have to explicitly allow themselves to be embedded.
* @since Chrome 43.
* @requires Permissions: 'appview'
* @see[Documentation]{@link https://developer.chrome.com/apps/tags/appview}
*/
declare class HTMLAppViewElement extends HTMLElement {
/**
* Requests another app to be embedded.
* @param app The extension id of the app to be embedded.
* @param [data] Optional developer specified data that the app to be embedded can use when making an embedding decision.
* @param [callback] Optional callback when the embedding request is completed. Will provide the result.
*/
connect(app: string, data?: any, callback?: (success: boolean) => void): void;
}
declare namespace AppView {
interface EmbedRequest {
/** The ID of the app that sent the embedding request. */
embedderId: string;
/** Optional developer specified data that the app to be embedded can use when making an embedding decision. */
data?: any;
/**
* Allows the embedding request
* @param url Specifies the content to be embedded.
*/
allow(url: string): void;
/** Prevents the embedding request */
deny(): void;
}
}
declare interface Document {
createElement(element: 'appview'): HTMLAppViewElement;
}
+2144 -611
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,10 +1,6 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es2017",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
@@ -13,6 +9,10 @@
"typeRoots": [
"../"
],
"lib": [
"es2017",
"dom"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+140
View File
@@ -0,0 +1,140 @@
// Type definitions for Chrome packaged application development
// Project: http://developer.chrome.com/apps/
// Definitions by: Nikolai Ommundsen <https://github.com/niikoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/////////////////////////
// WEB APIs & Warnings //
/////////////////////////
/**
* Only warnings since:
* 1. It's not possible as of now to override or remove something from *Window* or *Document*.
* 2. It may also cause other unforseen consequences if it's removed (and if it was possible).
* @see[Disallowed]
*/
/**
* Chrome app - Web APIs
* @see[Docs]{@link https://developer.chrome.com/apps/api_other}
*/
interface ChromeWindow {
///
/// Disabled Web Features
/// https://developer.chrome.com/apps/app_deprecated
///
/**
* ❗ alert is not available in packaged apps. ❗
* Work-around: Use a custom lightbox / popup.
*/
alert(message?: any): void;
/**
* ❗ confirm is not available in packaged apps. ❗
* Work-around: Use a custom lightbox / popup.
*/
confirm(message?: string): boolean;
/**
* ❗ window.location is not available in packaged apps. ❗
* Links open up with the system web browser.
*/
location: Location;
/**
* ❗ window.history is not available in packaged apps. ❗
* Links open up with the system web browser.
*/
readonly history: History;
///
/// Other APIs
///
AudioContext: typeof AudioContext;
//////////////////////////
// WebKit prefixed APIs //
//////////////////////////
webkitMediaStream: typeof MediaStream;
webkitRTCPeerConnection: typeof RTCPeerConnection;
}
interface Document {
/**
* ❗ document.cookie is not available in packaged apps. ❗
* Packaged app pages are not rendered on the server, so there is no need to use these.
*/
cookie: string;
/**
* ❗ document.close is not available in packaged apps. ❗
*/
close(): void;
/**
* ❗ document.open is not available in packaged apps. ❗
*/
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
/**
* ❗ document.write is not available in packaged apps. ❗
*/
write(...content: string[]): void;
}
/**
* ❗ iframes are not available in packaged apps, use webviews instead. ❗
*/
interface HTMLIFrameElement { }
/**
* ❗ Modal dialogs are not available in packaged apps, use lightbox/popup instead. ❗
*/
interface HTMLDialogElement { }
interface HTMLElement {
/**
* @requires Permissions: 'app.window.fullscreen', 'app.window.fullscreen.overrideEsc'
* @description
* In Chrome Apps, fullscreen is entered without prompting the user or providing
* exit instructions. HTML5 fullscreen requires the app.window.fullscreen permission
* in the manifest. In normal webpages, the browser intercepts the ESC key to exit
* pointer lock ensuring a consistent escape method for users. That is also the
* behavior in Chrome Apps unless the app.window.fullscreen.overrideEsc permission
* is used to enable the app to call preventDefault on keydown and keyup events.
*
* Then to exit fullscreen, the document exposes a method for that:
* @example
* document.webkitExitFullscreen();
*/
webkitRequestFullscreen(): void;
}
interface HTMLElement {
/**
* ❗ Unprefixed version are not available as of Chrome 68, in Chrome apps ❗
*/
requestFullscreen(): void;
/**
* ❗ Unprefixed version are not available as of Chrome 68, in Chrome apps ❗
*/
exitrequestFullscreen(): void;
/**
* @requires Permissions: 'pointerLock'
*/
requestPointerLock(): void;
/**
* @requires Permissions: 'pointerLock'
*/
exitPointerLock(): void;
}
interface Navigator {
/**
* If you provide the 'geolocation' in your Chrome app it will allow the app to
* use the proposed HTML5 geolocation API without prompting the user for permission.
* @see Permissions: 'geolocation'
*/
readonly geolocation: Geolocation;
}
/**
* ❗ window.localStorage is not available in packaged apps. Use chrome.storage.local instead. ❗
*/
declare var localStorage: typeof localStorage;
+5 -1
View File
@@ -639,7 +639,7 @@ declare namespace WebView {
/**
* The type of menu item. Defaults to 'normal' if not specified.
*/
type?: chrome.contextMenus.ItemType;
type?: chrome.ToStringLiteral<typeof chrome.contextMenus.ItemType>;
/**
* The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension.
@@ -1366,3 +1366,7 @@ declare namespace WebView {
newzoomFactor: chrome.double;
}
}
declare interface Document {
createElement(element: 'webview'): HTMLWebViewElement;
}