You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
838 B
39 lines
838 B
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}); |
|
|
|
} |
|
|
|
}; |