mirror of https://github.com/rails/rails
Simplify ActionCable.createConsumer by using default argument
This commit is contained in:
parent
3631d7eee4
commit
dbe073aebf
|
@ -452,11 +452,8 @@
|
|||
};
|
||||
return Consumer;
|
||||
}();
|
||||
function createConsumer(url) {
|
||||
if (url == null) {
|
||||
var urlConfig = getConfig("url");
|
||||
url = urlConfig ? urlConfig : INTERNAL.default_mount_path;
|
||||
}
|
||||
function createConsumer() {
|
||||
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getConfig("url") || INTERNAL.default_mount_path;
|
||||
return new Consumer(createWebSocketURL(url));
|
||||
}
|
||||
function getConfig(name) {
|
||||
|
|
|
@ -18,11 +18,7 @@ export {
|
|||
logger,
|
||||
}
|
||||
|
||||
export function createConsumer(url) {
|
||||
if (url == null) {
|
||||
const urlConfig = getConfig("url")
|
||||
url = (urlConfig ? urlConfig : INTERNAL.default_mount_path)
|
||||
}
|
||||
export function createConsumer(url = getConfig("url") || INTERNAL.default_mount_path) {
|
||||
return new Consumer(createWebSocketURL(url))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue