diff --git a/templates/demo/app/components/whisper.js b/templates/demo/app/components/whisper.js index 3c056bf21..29d2bb27c 100644 --- a/templates/demo/app/components/whisper.js +++ b/templates/demo/app/components/whisper.js @@ -22,6 +22,14 @@ class Whisper extends React.Component { this.setState(this.state); } + checkEnter(e, func) { + if (e.key !== 'Enter') { + return; + } + e.preventDefault(); + func.apply(this, [e]); + } + sendMessage (e) { e.preventDefault(); EmbarkJS.Messages.sendMessage({topic: this.state.channel, data: this.state.message}); @@ -68,7 +76,7 @@ class Whisper extends React.Component { : '' }