twister-react/build-buffer/.module-cache/42a9ad6e83cff4214ae7f4e976fe656a8ebb3db7.js
2015-04-30 11:22:58 +02:00

39 lines
838 B
JavaScript

module.exports = AppSettingsMixin = {
getInitialState: function() {
var state = {};
if (localStorage.getItem("twister-react-settings")) {
state.appSettings = {
pollInterval:60,
pollIntervalProfile: 3600,
ignoredUsers: "nobody"
};
} 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});
}
};