aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/utils.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-09-17 15:22:42 +0200
committerMaximilian Hils <git@maximilianhils.com>2014-09-17 15:22:42 +0200
commit8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6 (patch)
tree7ead6c2c6a6ed2fadba59aefa1d5743fbc4dfe9b /web/src/js/utils.js
parentb4ecd96beb77a8bae02d82eac174dded198797a3 (diff)
downloadmitmproxy-8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6.tar.gz
mitmproxy-8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6.tar.bz2
mitmproxy-8245dd19f4f2f4cdd74a6fdf9b5e051c2cd2fac6.zip
connect eventlog events to ui
Diffstat (limited to 'web/src/js/utils.js')
-rw-r--r--web/src/js/utils.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/web/src/js/utils.js b/web/src/js/utils.js
new file mode 100644
index 00000000..39ad92fb
--- /dev/null
+++ b/web/src/js/utils.js
@@ -0,0 +1,13 @@
+// http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html (also contains inverse example)
+var AutoScrollMixin = {
+ componentWillUpdate: function () {
+ var node = this.getDOMNode();
+ this._shouldScrollBottom = node.scrollTop + node.clientHeight === node.scrollHeight;
+ },
+ componentDidUpdate: function () {
+ if (this._shouldScrollBottom) {
+ var node = this.getDOMNode();
+ node.scrollTop = node.scrollHeight;
+ }
+ },
+};