fix debounce on safari
This commit is contained in:
parent
a4b6dd194e
commit
0ccfeb6b9c
2 changed files with 7 additions and 7 deletions
|
@ -27,7 +27,7 @@ import InlineSVG from 'react-inlinesvg';
|
||||||
const downArrowUrl = require('../../../images/down-arrow.svg');
|
const downArrowUrl = require('../../../images/down-arrow.svg');
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { debounce } from 'throttle-debounce';
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
class Editor extends React.Component {
|
class Editor extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -49,7 +49,7 @@ class Editor extends React.Component {
|
||||||
gutters: ['CodeMirror-lint-markers'],
|
gutters: ['CodeMirror-lint-markers'],
|
||||||
keyMap: 'sublime',
|
keyMap: 'sublime',
|
||||||
lint: {
|
lint: {
|
||||||
onUpdateLinting: debounce(2000, (annotations) => {
|
onUpdateLinting: debounce((annotations) => {
|
||||||
this.props.clearLintMessage();
|
this.props.clearLintMessage();
|
||||||
annotations.forEach((x) => {
|
annotations.forEach((x) => {
|
||||||
if (x.from.line > -1) {
|
if (x.from.line > -1) {
|
||||||
|
@ -59,17 +59,17 @@ class Editor extends React.Component {
|
||||||
if (this.props.lintMessages.length > 0 && this.props.lintWarning) {
|
if (this.props.lintMessages.length > 0 && this.props.lintWarning) {
|
||||||
this.beep.play();
|
this.beep.play();
|
||||||
}
|
}
|
||||||
})
|
}, 2000)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._cm.on('change', debounce(400, () => {
|
this._cm.on('change', debounce(() => {
|
||||||
this.props.setUnsavedChanges(true);
|
this.props.setUnsavedChanges(true);
|
||||||
this.props.updateFileContent(this.props.file.name, this._cm.getValue());
|
this.props.updateFileContent(this.props.file.name, this._cm.getValue());
|
||||||
if (this.props.autorefresh && this.props.isPlaying) {
|
if (this.props.autorefresh && this.props.isPlaying) {
|
||||||
this.props.startRefreshSketch();
|
this.props.startRefreshSketch();
|
||||||
}
|
}
|
||||||
}));
|
}, 400));
|
||||||
|
|
||||||
this._cm.on('keyup', () => {
|
this._cm.on('keyup', () => {
|
||||||
const temp = `line ${parseInt((this._cm.getCursor().line) + 1, 10)}`;
|
const temp = `line ${parseInt((this._cm.getCursor().line) + 1, 10)}`;
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
"jshint": "^2.9.2",
|
"jshint": "^2.9.2",
|
||||||
"jszip": "^3.0.0",
|
"jszip": "^3.0.0",
|
||||||
"jszip-utils": "0.0.2",
|
"jszip-utils": "0.0.2",
|
||||||
|
"lodash": "^4.16.4",
|
||||||
"loop-protect": "git+https://git@github.com/sagar-sm/loop-protect.git",
|
"loop-protect": "git+https://git@github.com/sagar-sm/loop-protect.git",
|
||||||
"moment": "^2.14.1",
|
"moment": "^2.14.1",
|
||||||
"mongoose": "^4.4.16",
|
"mongoose": "^4.4.16",
|
||||||
|
@ -104,7 +105,6 @@
|
||||||
"s3-policy": "^0.2.0",
|
"s3-policy": "^0.2.0",
|
||||||
"shortid": "^2.2.6",
|
"shortid": "^2.2.6",
|
||||||
"srcdoc-polyfill": "^0.2.0",
|
"srcdoc-polyfill": "^0.2.0",
|
||||||
"throttle-debounce": "^1.0.1",
|
|
||||||
"xhr": "^2.2.1"
|
"xhr": "^2.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue