diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js index 9bb18486..855d500b 100644 --- a/client/modules/IDE/components/Editor.js +++ b/client/modules/IDE/components/Editor.js @@ -27,7 +27,7 @@ import InlineSVG from 'react-inlinesvg'; const downArrowUrl = require('../../../images/down-arrow.svg'); import classNames from 'classnames'; -import { debounce } from 'throttle-debounce'; +import { debounce } from 'lodash'; class Editor extends React.Component { constructor(props) { @@ -49,7 +49,7 @@ class Editor extends React.Component { gutters: ['CodeMirror-lint-markers'], keyMap: 'sublime', lint: { - onUpdateLinting: debounce(2000, (annotations) => { + onUpdateLinting: debounce((annotations) => { this.props.clearLintMessage(); annotations.forEach((x) => { if (x.from.line > -1) { @@ -59,17 +59,17 @@ class Editor extends React.Component { if (this.props.lintMessages.length > 0 && this.props.lintWarning) { this.beep.play(); } - }) + }, 2000) } }); - this._cm.on('change', debounce(400, () => { + this._cm.on('change', debounce(() => { this.props.setUnsavedChanges(true); this.props.updateFileContent(this.props.file.name, this._cm.getValue()); if (this.props.autorefresh && this.props.isPlaying) { this.props.startRefreshSketch(); } - })); + }, 400)); this._cm.on('keyup', () => { const temp = `line ${parseInt((this._cm.getCursor().line) + 1, 10)}`; diff --git a/package.json b/package.json index 9085b058..c5b29390 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "dropzone": "^4.3.0", "escape-string-regexp": "^1.0.5", "eslint-loader": "^1.3.0", - "express": "^4.13.4", + "express": "^4.13.4", "express-session": "^1.13.0", "file-saver": "^1.3.2", "file-type": "^3.8.0", @@ -83,6 +83,7 @@ "jshint": "^2.9.2", "jszip": "^3.0.0", "jszip-utils": "0.0.2", + "lodash": "^4.16.4", "loop-protect": "git+https://git@github.com/sagar-sm/loop-protect.git", "moment": "^2.14.1", "mongoose": "^4.4.16", @@ -104,7 +105,6 @@ "s3-policy": "^0.2.0", "shortid": "^2.2.6", "srcdoc-polyfill": "^0.2.0", - "throttle-debounce": "^1.0.1", "xhr": "^2.2.1" } }