DefinitelyTyped/types/webcomponents.js/index.d.ts
Nathan Shively-Sanders f0ce987bc1 Update project urls to match NPM url
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.
2019-02-11 17:10:55 -08:00

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;
}
}