fix debounce on safari

This commit is contained in:
Cassie Tarakajian 2016-10-19 13:29:02 -04:00
parent a4b6dd194e
commit 0ccfeb6b9c
2 changed files with 7 additions and 7 deletions

View file

@ -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)}`;

View file

@ -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"
}
}