mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-01-13 16:37:58 +00:00
40 lines
890 B
JavaScript
40 lines
890 B
JavaScript
|
module.exports = AppSettingsMixin = {
|
||
|
getInitialState: function() {
|
||
|
|
||
|
var state = {};
|
||
|
|
||
|
if (!localStorage.getItem("twister-react-settings")) {
|
||
|
|
||
|
state.appSettings = {
|
||
|
|
||
|
pollInterval:60,
|
||
|
pollIntervalProfile: 3600,
|
||
|
ignoredUsers: "nobody",
|
||
|
host: "http://user:pwd@localhost:28332"
|
||
|
|
||
|
};
|
||
|
|
||
|
} else {
|
||
|
|
||
|
state.appSettings = JSON.parse(localStorage.getItem("twister-react-settings"));
|
||
|
|
||
|
}
|
||
|
|
||
|
//console.log(state);
|
||
|
|
||
|
return state;
|
||
|
|
||
|
},
|
||
|
componentDidMount: function() {
|
||
|
window.addEventListener("appsettingschanged", this.onappsettingschanged);
|
||
|
},
|
||
|
componentWillUnmount: function() {
|
||
|
window.removeEventListener("appsettingschanged", this.onappsettingschanged);
|
||
|
},
|
||
|
onappsettingschanged: function(event) {
|
||
|
|
||
|
this.setState({appSettings: event.detail});
|
||
|
|
||
|
}
|
||
|
|
||
|
};
|