viewerjs-react
Advanced tools
Comparing version 0.0.2 to 1.0.0
@@ -11,4 +11,6 @@ import * as React from 'react'; | ||
private onRef; | ||
componentDidUpdate(): void; | ||
componentWillUnmount(): void; | ||
render(): JSX.Element; | ||
} | ||
export {}; |
@@ -20,2 +20,3 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
_this = _React$PureComponent.apply(this, arguments) || this; | ||
_this.viewer = null; | ||
@@ -31,3 +32,3 @@ _this.onRef = function (el) { | ||
_this.viewer = new ViewerJS(el); | ||
_this.viewer = new ViewerJS(el, _this.props.options); | ||
}; | ||
@@ -40,2 +41,16 @@ | ||
_proto.componentDidUpdate = function componentDidUpdate() { | ||
if (this.viewer) { | ||
this.viewer.update(); | ||
} | ||
}; | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
if (this.viewer) { | ||
this.viewer.destroy(); | ||
} | ||
this.viewer = null; | ||
}; | ||
_proto.render = function render() { | ||
@@ -42,0 +57,0 @@ return React.createElement("div", { |
@@ -18,2 +18,3 @@ import { createElement, PureComponent } from 'react'; | ||
_this = _React$PureComponent.apply(this, arguments) || this; | ||
_this.viewer = null; | ||
@@ -29,3 +30,3 @@ _this.onRef = function (el) { | ||
_this.viewer = new ViewerJS(el); | ||
_this.viewer = new ViewerJS(el, _this.props.options); | ||
}; | ||
@@ -38,2 +39,16 @@ | ||
_proto.componentDidUpdate = function componentDidUpdate() { | ||
if (this.viewer) { | ||
this.viewer.update(); | ||
} | ||
}; | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
if (this.viewer) { | ||
this.viewer.destroy(); | ||
} | ||
this.viewer = null; | ||
}; | ||
_proto.render = function render() { | ||
@@ -40,0 +55,0 @@ return createElement("div", { |
{ | ||
"name": "viewerjs-react", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"description": "React wrapper for viewerjs.", | ||
@@ -5,0 +5,0 @@ "author": "tinymins", |
@@ -18,3 +18,3 @@ # viewerjs-react | ||
import MyComponent from 'viewerjs-react' | ||
import RViewerJS from 'viewerjs-react' | ||
import 'viewerjs-react/dist/index.css' | ||
@@ -24,3 +24,5 @@ | ||
render() { | ||
return <MyComponent /> | ||
return <RViewerJS> | ||
<img src="xxx" /> | ||
</RViewerJS> | ||
} | ||
@@ -30,4 +32,10 @@ } | ||
## Props | ||
### options | ||
Will passby to viewerjs. See [ViewerJS Options Document](https://github.com/fengyuanchen/viewerjs/blob/master/README.md#options). | ||
## License | ||
MIT © [tinymins](https://github.com/tinymins) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
9756
111
1
39