mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-01-27 15:14:30 +00:00
17 lines
546 B
JavaScript
17 lines
546 B
JavaScript
module.exports = AppSettingsMixin = {
|
|
getInitialState: function() {
|
|
this.appSettings = JSON.parse(localStorage.getItem("twister-react-settings"));
|
|
},
|
|
componentDidMount: function() {
|
|
window.addEventListener("appsettingschanged", this.onappsettingschanged);
|
|
},
|
|
componentWillUnmount: function() {
|
|
window.removeEventListener("appsettingschanged", this.onappsettingschanged);
|
|
},
|
|
onappsettingschanged: function() {
|
|
|
|
this.setState({appSettings: JSON.parse(localStorage.getItem("twister-react-settings"))});
|
|
|
|
}
|
|
|
|
}; |