mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Note that this *trivially* updates project urls by adding the NPM url to the end, even when the urls are almost identical or the DT one is outdated. I'll clean up the urls in a later commit. This PR is unfinished! Please do not merge it yet.
70 lines
1.8 KiB
TypeScript
70 lines
1.8 KiB
TypeScript
// Type definitions for webcomponents.js 0.6
|
|
// Project: https://github.com/webcomponents/webcomponentsjs, http://webcomponents.org
|
|
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
export interface CustomElementInit {
|
|
prototype: HTMLElement;
|
|
extends?: string;
|
|
}
|
|
|
|
export interface CustomElementConstructor {
|
|
new(): HTMLElement;
|
|
}
|
|
|
|
export interface CustomElementsPolyfill {
|
|
hasNative: boolean;
|
|
flags: any;
|
|
ready: boolean;
|
|
useNative: boolean;
|
|
}
|
|
|
|
export interface HTMLImportsPolyfill {
|
|
IMPORT_LINK_TYPE: string;
|
|
isIE: boolean;
|
|
flags: any;
|
|
ready: boolean;
|
|
rootDocument: Document;
|
|
useNative: boolean;
|
|
whenReady(callback: () => void): void;
|
|
}
|
|
|
|
export interface Polyfill {
|
|
flags: any;
|
|
}
|
|
|
|
declare global {
|
|
// This contains duplicates of some types in lib.dom.d.ts in order to support typescript 2.0
|
|
interface ElementDefinitionOptions {
|
|
extends?: string;
|
|
}
|
|
|
|
interface ShadowRoot extends DocumentFragment {
|
|
innerHTML: string;
|
|
readonly host: Element;
|
|
}
|
|
|
|
interface CustomElementRegistry {
|
|
define(name: string, constructor: Function, options?: ElementDefinitionOptions): void;
|
|
get(name: string): any;
|
|
whenDefined(name: string): PromiseLike<void>;
|
|
}
|
|
|
|
interface Element {
|
|
createShadowRoot(): ShadowRoot;
|
|
readonly shadowRoot: ShadowRoot | null;
|
|
}
|
|
|
|
interface Document {
|
|
registerElement(name: string, prototype: CustomElementInit): CustomElementConstructor;
|
|
}
|
|
|
|
interface Window {
|
|
CustomElements: CustomElementsPolyfill;
|
|
HTMLImports: HTMLImportsPolyfill;
|
|
WebComponents: Polyfill;
|
|
|
|
customElements: CustomElementRegistry;
|
|
}
|
|
}
|