Socket
Socket
Sign inDemoInstall

react-reading-progress

Package Overview
Dependencies
12
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.2.2

11

lib/index.js

@@ -72,4 +72,6 @@ 'use strict';

_this.update = function () {
var value = !_this.props.rootEl ? window.pageYOffset || document.documentElement.scrollTop : _this.rootEl.scrollTop;
_this.setState({
value: window.pageYOffset || document.documentElement.scrollTop
value: value
});

@@ -110,6 +112,11 @@ };

}, {
key: 'measureViewportHeight',
value: function measureViewportHeight() {
return !this.props.rootEl ? Math.max(document.documentElement.clientHeight, window.innerHeight || 0) : this.rootEl.clientHeight;
}
}, {
key: 'measure',
value: function measure() {
this.targetHeight = this.targetEl.getBoundingClientRect().height;
this.viewportH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
this.viewportH = this.measureViewportHeight();
this.max = this.targetHeight - this.viewportH + this.targetEl.offsetTop;

@@ -116,0 +123,0 @@ }

2

package.json
{
"name": "react-reading-progress",
"version": "0.1.2",
"version": "0.2.2",
"main": "./lib/index.js",

@@ -5,0 +5,0 @@ "author": "makotot",

@@ -27,7 +27,21 @@ # react-reading-progress

<ReadingProgress targetEl="#target-el" />
<article id="target-el">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vel pharetra vel turpis nunc. Ut sem viverra aliquet eget sit amet tellus. Lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit. In mollis nunc sed id semper risus in hendrerit gravida. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Amet purus gravida quis blandit. Et ultrices neque ornare aenean euismod elementum nisi quis. Vitae aliquet nec ullamcorper sit amet.
</article>
```
## Props
### `targetEl={ String }`
Target article's selector. If this prop is not specified, `document.body` will be used.
### `rootEl={ String }`
Root element selector. If this prop is not specified, `window` will be used.
## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc