Skip to content

Commit 9e985fc

Browse files
committed
added a pop sound for new messags
1 parent 095d91e commit 9e985fc

File tree

6 files changed

+1365
-4
lines changed

6 files changed

+1365
-4
lines changed

app/assets/images/pop.mp3

33.9 KB
Binary file not shown.

app/assets/javascripts/application.js.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ $ ->
2828

2929
document.current_user_likes = new Likes(document.current_user_id)
3030

31+
@playPop = ->
32+
audio_file = $("meta[property='audio']").attr("content")
33+
sound = new Howl(urls: [audio_file])
34+
sound.play()
35+
3136
@setUserId = ->
3237
userId = $("meta[property='current_user:id']").attr("content")
3338
document.current_user_id = userId if userId?

app/assets/javascripts/components/Chat.es6.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class Chat extends React.Component {
148148
const pusher = new Pusher(this.props.pusherKey)
149149
const channel = pusher.subscribe(this.props.chatChannel)
150150
channel.bind('new-comment', comment => {
151+
151152
this.setState({comments: [...this.state.comments, comment]})
152153
})
153154

0 commit comments

Comments
 (0)