-
Notifications
You must be signed in to change notification settings - Fork 22.3k
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (30 loc) · 869 Bytes
/
index.js
File metadata and controls
33 lines (30 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import adapters from "./adapters"
import Connection from "./connection"
import ConnectionMonitor from "./connection_monitor"
import Consumer, { createWebSocketURL } from "./consumer"
import INTERNAL from "./internal"
import logger from "./logger"
import Subscription from "./subscription"
import SubscriptionGuarantor from "./subscription_guarantor"
import Subscriptions from "./subscriptions"
export {
Connection,
ConnectionMonitor,
Consumer,
INTERNAL,
Subscription,
Subscriptions,
SubscriptionGuarantor,
adapters,
createWebSocketURL,
logger,
}
export function createConsumer(url = getConfig("url") || INTERNAL.default_mount_path) {
return new Consumer(url)
}
export function getConfig(name) {
const element = document.head.querySelector(`meta[name='action-cable-${name}']`)
if (element) {
return element.getAttribute("content")
}
}