Fix JS syntax on Action Cable Overview

Change two JavaScript examples in the Action Cable Overview guide to fix
a couple of issues that seem to come from employing rubyisms:

- a syntax error by using keyword arguments instead of a plain object
- using == instead of === - this should be avoided if at all possible
This commit is contained in:
Román Coitiño 2021-10-05 23:31:27 -03:00
parent fb1ab3460a
commit 0b234d72cd
1 changed files with 2 additions and 2 deletions

View File

@ -585,7 +585,7 @@ consumer.subscriptions.create("AppearanceChannel", {
},
get documentIsActive() {
return document.visibilityState == "visible" && document.hasFocus()
return document.visibilityState === "visible" && document.hasFocus()
},
get appearingOn() {
@ -653,7 +653,7 @@ import consumer from "./consumer"
consumer.subscriptions.create("WebNotificationsChannel", {
received(data) {
new Notification(data["title"], body: data["body"])
new Notification(data["title"], { body: data["body"] })
}
})
```