mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Html2canvas 0.5 (#9293)
* Merge function with optional argument. * Align function to 0.5.0 (by replacing callback by Promise.) * Declare module for easier import. * Format. * Update version and author information. * Use ES6 Promise directly. Since DefinitelyTyped recommend compilation with `--target es6` and `--noImplicitAny` options. * Revert "Use ES6 Promise directly." Projects targeting es5 wouldn't compile due to the leak of ES6 Promise. This reverts commit 7d022d153c0601384d920671a3150fa7bcacd166. * Fixed header format.
This commit is contained in:
committed by
Masahiro Wakame
parent
9fb3c230e0
commit
8a851abfad
Vendored
+22
-16
@@ -1,6 +1,6 @@
|
||||
// Type definitions for html2canvas.js v0.4.1
|
||||
// Type definitions for html2canvas.js v0.5.0-bata.4
|
||||
// Project: https://github.com/niklasvh/html2canvas
|
||||
// Definitions by: Richard Hepburn <https://github.com/rwhepburn/>
|
||||
// Definitions by: Richard Hepburn <https://github.com/rwhepburn/>, Pei-Tang Huang <https://github.com/tan9/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
@@ -36,26 +36,14 @@ declare namespace Html2Canvas {
|
||||
|
||||
/** Whether to attempt to load cross-origin images as CORS served, before reverting back to proxy. */
|
||||
useCORS?: boolean;
|
||||
|
||||
|
||||
/** Use svg powered rendering where available (FF11+). */
|
||||
svgRendering?: boolean;
|
||||
|
||||
/** Callback providing the rendered canvas element after rendering */
|
||||
onrendered?(canvas: HTMLCanvasElement): void;
|
||||
}
|
||||
}
|
||||
|
||||
interface Html2CanvasStatic {
|
||||
|
||||
/**
|
||||
* Renders an HTML element to a canvas so that a screenshot can be generated.
|
||||
*
|
||||
* The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot,
|
||||
* but builds the screenshot based on the information available on the page.
|
||||
*
|
||||
* @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window.
|
||||
*/
|
||||
(element: HTMLElement): void;
|
||||
/**
|
||||
* Renders an HTML element to a canvas so that a screenshot can be generated.
|
||||
*
|
||||
@@ -65,7 +53,25 @@ interface Html2CanvasStatic {
|
||||
* @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window.
|
||||
* @param {Html2CanvasOptions} options The options object that controls how the element will be rendered.
|
||||
*/
|
||||
(element: HTMLElement, options: Html2Canvas.Html2CanvasOptions): void;
|
||||
(element: HTMLElement, options?: Html2Canvas.Html2CanvasOptions): Html2CanvasPromise<HTMLCanvasElement>;
|
||||
}
|
||||
|
||||
// FIXME:
|
||||
// Find out a way to dependent on real Promise interface.
|
||||
// And remove following custome Promise interface.
|
||||
interface Html2CanvasThenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | Html2CanvasThenable<U>, onRejected?: (error: any) => U | Html2CanvasThenable<U>): Html2CanvasThenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Html2CanvasThenable<U>, onRejected?: (error: any) => void): Html2CanvasThenable<U>;
|
||||
}
|
||||
|
||||
interface Html2CanvasPromise<R> extends Html2CanvasThenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | Html2CanvasThenable<U>, onRejected?: (error: any) => U | Html2CanvasThenable<U>): Html2CanvasPromise<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Html2CanvasThenable<U>, onRejected?: (error: any) => void): Html2CanvasPromise<U>;
|
||||
catch<U>(onRejected?: (error: any) => U | Html2CanvasThenable<U>): Html2CanvasPromise<U>;
|
||||
}
|
||||
|
||||
declare module 'html2canvas' {
|
||||
export = html2canvas;
|
||||
}
|
||||
|
||||
declare var html2canvas: Html2CanvasStatic;
|
||||
|
||||
Reference in New Issue
Block a user