temporarily remote autorefresh and loop protect
This commit is contained in:
parent
1232e4c5ca
commit
dfc55aaa5b
5 changed files with 28 additions and 15 deletions
|
@ -68,11 +68,14 @@ class Editor extends React.Component {
|
||||||
this._cm.on('change', debounce(1000, () => {
|
this._cm.on('change', debounce(1000, () => {
|
||||||
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());
|
||||||
this.checkForInfiniteLoop((infiniteLoop, prevs) => {
|
if (this.props.autorefresh && this.props.isPlaying) {
|
||||||
if (!infiniteLoop && prevs && this.props.autorefresh) {
|
|
||||||
this.props.startRefreshSketch();
|
this.props.startRefreshSketch();
|
||||||
}
|
}
|
||||||
});
|
// this.checkForInfiniteLoop((infiniteLoop, prevs) => {
|
||||||
|
// if (!infiniteLoop && prevs && this.props.autorefresh) {
|
||||||
|
// this.props.startRefreshSketch();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._cm.on('keyup', () => {
|
this._cm.on('keyup', () => {
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Toolbar extends React.Component {
|
||||||
>
|
>
|
||||||
<InlineSVG src={stopUrl} alt="Stop Sketch" />
|
<InlineSVG src={stopUrl} alt="Stop Sketch" />
|
||||||
</button>
|
</button>
|
||||||
<div className="toolbar__autorefresh">
|
{/* <div className="toolbar__autorefresh">
|
||||||
<input
|
<input
|
||||||
id="autorefresh"
|
id="autorefresh"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
@ -84,7 +84,7 @@ class Toolbar extends React.Component {
|
||||||
<label htmlFor="autorefresh" className="toolbar__autorefresh-label">
|
<label htmlFor="autorefresh" className="toolbar__autorefresh-label">
|
||||||
Auto-refresh
|
Auto-refresh
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div> */}
|
||||||
<div className={nameContainerClass}>
|
<div className={nameContainerClass}>
|
||||||
<a
|
<a
|
||||||
className="toolbar__project-name"
|
className="toolbar__project-name"
|
||||||
|
|
|
@ -8,7 +8,7 @@ const initialState = {
|
||||||
lintWarning: false,
|
lintWarning: false,
|
||||||
textOutput: false,
|
textOutput: false,
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
autorefresh: true
|
autorefresh: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const preferences = (state = initialState, action) => {
|
const preferences = (state = initialState, action) => {
|
||||||
|
|
|
@ -17,7 +17,7 @@ const userSchema = new Schema({
|
||||||
lintWarning: { type: Boolean, default: false },
|
lintWarning: { type: Boolean, default: false },
|
||||||
textOutput: { type: Boolean, default: false },
|
textOutput: { type: Boolean, default: false },
|
||||||
theme: { type: String, default: 'light' },
|
theme: { type: String, default: 'light' },
|
||||||
autorefresh: { type: Boolean, default: true }
|
autorefresh: { type: Boolean, default: false }
|
||||||
}
|
}
|
||||||
}, { timestamps: true });
|
}, { timestamps: true });
|
||||||
|
|
||||||
|
|
|
@ -117,11 +117,21 @@ import User from '../models/user';
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
User.findOne({email: 'test@test.com'})
|
// User.findOne({email: 'test@test.com'})
|
||||||
.exec((err, user) => {
|
// .exec((err, user) => {
|
||||||
console.log(user);
|
// console.log(user);
|
||||||
user.password = '1234';
|
// user.password = '1234';
|
||||||
|
// user.save((err, savedUser) => {
|
||||||
|
// console.log('user saved');
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
User.find({})
|
||||||
|
.exec((err, users) => {
|
||||||
|
users.forEach(user => {
|
||||||
|
user.preferences.autorefresh = false;
|
||||||
user.save((err, savedUser) => {
|
user.save((err, savedUser) => {
|
||||||
console.log('user saved');
|
console.log('user saved');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue