mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
d03177ffbc
* Remove unnecessary variable from ActionCable.createWebSocketURL * Improve ActionCable test by creating the Consumer before reassigning URL With this change, the test now actually verifies that the Consumer's url property changes dynamically (from testURL to `${testURL}foo`). * Fix alphabetization of ActionCable exports
31 lines
783 B
JavaScript
31 lines
783 B
JavaScript
import Connection from "./connection"
|
|
import ConnectionMonitor from "./connection_monitor"
|
|
import Consumer, { createWebSocketURL } from "./consumer"
|
|
import INTERNAL from "./internal"
|
|
import Subscription from "./subscription"
|
|
import Subscriptions from "./subscriptions"
|
|
import adapters from "./adapters"
|
|
import logger from "./logger"
|
|
|
|
export {
|
|
Connection,
|
|
ConnectionMonitor,
|
|
Consumer,
|
|
INTERNAL,
|
|
Subscription,
|
|
Subscriptions,
|
|
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")
|
|
}
|
|
}
|