Debounce twitter calls to 5 seconds

main
Mike Fix 7 years ago committed by Brian Dennis
parent 97c52e1b9a
commit a5f42043d3

@ -17,8 +17,10 @@
"express": "^4.15.3",
"form-data": "^2.2.0",
"highlight.js": "^9.12.0",
"lodash.debounce": "^4.0.8",
"morgan": "^1.8.2",
"morphmorph": "0.0.2",
"ms": "^2.0.0",
"next": "^3.2.2",
"react": "^15.6.1",
"react-click-outside": "^2.3.1",

@ -3,6 +3,8 @@ import React from 'react'
import HTML5Backend from 'react-dnd-html5-backend'
import { DragDropContext } from 'react-dnd'
import domtoimage from 'dom-to-image'
import debounce from 'lodash.debounce'
import ms from 'ms'
// Ours
import Page from '../components/Page'
@ -111,7 +113,7 @@ class Editor extends React.Component {
<div className="buttons">
<Button
className="tweetButton"
onClick={this.upload}
onClick={debounce(this.upload, ms('5s'), {leading: true, trailing: false})}
title={this.state.uploading ? 'Loading...' : 'Tweet Image'}
color="#57b5f9"
style={{ marginRight: '8px' }}

@ -2246,7 +2246,7 @@ lodash-es@^4.2.1:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7"
lodash.debounce@^4.0.4:
lodash.debounce@^4.0.4, lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
@ -2411,7 +2411,7 @@ morphmorph@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/morphmorph/-/morphmorph-0.0.2.tgz#b2401b5e976ca4f4e068b730145aa64634aaa689"
ms@2.0.0:
ms@2.0.0, ms@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

Loading…
Cancel
Save