Mux webview console messages into main window

This commit is contained in:
Yuya Ochiai
2016-02-13 19:30:37 +09:00
parent 3b6dfcaabe
commit 87efd4e48a

View File

@@ -142,7 +142,7 @@ var MainPage = React.createClass({
var handleNotificationClick = function() { var handleNotificationClick = function() {
thisObj.handleSelect(index); thisObj.handleSelect(index);
} }
return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick } return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick }
/>) />)
}); });
var views_row = (<Row> var views_row = (<Row>
@@ -268,12 +268,12 @@ var MattermostView = React.createClass({
case 'onNotificationClick': case 'onNotificationClick':
thisObj.props.onNotificationClick(); thisObj.props.onNotificationClick();
break; break;
case 'console':
console.log(event.args[0]);
break;
} }
}); });
webview.addEventListener('console-message', (e) => {
console.log(`[${this.props.name}]`, e.message);
});
}, },
render: function() { render: function() {
// 'disablewebsecurity' is necessary to display external images. // 'disablewebsecurity' is necessary to display external images.