|
@@ -54,6 +54,17 @@ class Thread extends React.Component {
|
54
|
54
|
document.addEventListener('appCustomEvent', this.customEventReducer)
|
55
|
55
|
}
|
56
|
56
|
|
|
57
|
+ customEventReducer = ({ detail: action }) => { // action: { type: '', data: {} }
|
|
58
|
+ switch (action.type) {
|
|
59
|
+ case 'Thread_showApp':
|
|
60
|
+ this.setState({isVisible: true})
|
|
61
|
+ break
|
|
62
|
+ case 'Thread_hideApp':
|
|
63
|
+ this.setState({isVisible: false})
|
|
64
|
+ break
|
|
65
|
+ }
|
|
66
|
+ }
|
|
67
|
+
|
57
|
68
|
async componentDidMount () {
|
58
|
69
|
const { workspace, content, appConfig } = this.state
|
59
|
70
|
if (content.id === '-1') return // debug case
|
|
@@ -70,14 +81,6 @@ class Thread extends React.Component {
|
70
|
81
|
})
|
71
|
82
|
}
|
72
|
83
|
|
73
|
|
- customEventReducer = ({detail}) => {
|
74
|
|
- switch (detail.type) {
|
75
|
|
- case 'Thread_showMsg': // unused for now, for testing purpose
|
76
|
|
- this.setState({inputText: detail.content})
|
77
|
|
- break
|
78
|
|
- }
|
79
|
|
- }
|
80
|
|
-
|
81
|
84
|
handleClickBtnCloseApp = () => {
|
82
|
85
|
this.setState({ isVisible: false })
|
83
|
86
|
}
|