Skip to content

Commit 4c0209e

Browse files
authored
Merge pull request rails#54776 from codergeek121/patch-1
Convert ActionCable CoffeeScript example to JavaScript
2 parents 951ea8f + 4f96de0 commit 4c0209e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

actioncable/lib/action_cable/server/broadcasting.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ module Server
2121
# ActionCable.server.broadcast \
2222
# "web_notifications_1", { title: "New things!", body: "All that's fit for print" }
2323
#
24-
# # Client-side CoffeeScript, which assumes you've already requested the right to send web notifications:
25-
# App.cable.subscriptions.create "WebNotificationsChannel",
26-
# received: (data) ->
27-
# new Notification data['title'], body: data['body']
24+
# # Client-side JavaScript, which assumes you've already requested the right to send web notifications:
25+
# App.cable.subscriptions.create("WebNotificationsChannel", {
26+
# received: function(data) {
27+
# new Notification(data['title'], { body: data['body'] })
28+
# }
29+
# })
2830
module Broadcasting
2931
# Broadcast a hash directly to a named `broadcasting`. This will later be JSON
3032
# encoded.

0 commit comments

Comments
 (0)