update(react-faux-dom): Update types to reflect new library version.

This commit is contained in:
Michał Kostrzyński
2018-02-12 12:06:51 +01:00
parent 56ce1312c8
commit f0e9ea8b77
2 changed files with 16 additions and 8 deletions
+7 -8
View File
@@ -1,7 +1,8 @@
// Type definitions for react-faux-dom 3.2
// Type definitions for react-faux-dom 4.1
// Project: https://github.com/Olical/react-faux-dom
// Definitions by: Ali Taheri Moghaddar <https://github.com/alitaheri>
// Cleve Littlefield <https://github.com/cleverguy25>
// Michał Kostrzyński <https://github.com/deviousm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -19,11 +20,6 @@ export const defaultView: {
getComputedStyle(node: Element): { getPropertyValue(name: string): string };
};
export namespace mixins {
const core: any;
const anim: any;
}
export function createElement(nodeName: string): Element;
export function createElementNS(namespace: string, nodeName: string): Element;
@@ -31,8 +27,11 @@ export function createElementNS(namespace: string, nodeName: string): Element;
export function compareDocumentPosition(): number;
export interface ReactFauxDomProps {
connectFauxDOM?(node: string, name: string, discardNode?: any): Element;
animateFauxDOM?(duration: number): void;
connectFauxDOM(node: string, name: string, discardNode?: any): Element;
drawFauxDOM(): void;
animateFauxDOM(duration: number): void;
stopAnimatingFauxDOM(): void;
isAnimatingFauxDOM(): boolean;
}
export function withFauxDOM<P>(WrappedComponent: any): React.ClassicComponentClass<P & ReactFauxDomProps>;
@@ -34,9 +34,18 @@ class MyReactComponent extends React.Component<ChartProps> {
.append('div')
.html('Hello World!');
this.props.animateFauxDOM(800);
console.log(this.props.isAnimatingFauxDOM());
}
}
componentDidUpdate() {
this.props.drawFauxDOM();
}
componentWillUnmount() {
this.props.stopAnimatingFauxDOM();
}
render() {
return <div>
<h2>Here is some fancy data:</h2>