提交 dbe073ae 编写于 作者: R Richard Macklin

Simplify ActionCable.createConsumer by using default argument

上级 3631d7ee
......@@ -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))
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册