-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modernize js #1468
base: master
Are you sure you want to change the base?
modernize js #1468
Conversation
Current JavaScript [standards](https://medium.com/@codingsam/awesome-javascript-no-more-var-working-title-999428999994) encourage us to use of let and const instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a review of your let
and const
usage. Current state would break instantly on every browser.
By the way, encouragement of let/const is only true when using >= ES6. I don't know anything about the usage of this file or where it is used within Ventoy, but keep in mind that your (or your client's) js runtime needs to support >= ES6.
var url = '/vtoy/json'; | ||
var data = {}; | ||
var func = function(data) {}; | ||
const url = '/vtoy/json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's let
, not const
var data = {}; | ||
var func = function(data) {}; | ||
const url = '/vtoy/json'; | ||
const data = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's let
, not const
var func = function(data) {}; | ||
const url = '/vtoy/json'; | ||
const data = {}; | ||
const func = function(data) {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's let
, not const
msg : "提示内容", | ||
type: 'S', | ||
time: 3000 | ||
}; | ||
$.extend(ops, options); | ||
|
||
var msg_class = 'alert-success'; | ||
const msg_class = 'alert-success'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's let
, not const
@@ -242,29 +242,29 @@ window.Message = function() { | |||
alert("未知的类型,请使用: w-警告;s-成功;e-失败;i-提示"); | |||
return; | |||
} | |||
var $messageContainer = $("#fcss_message"); | |||
const $messageContainer = $("#fcss_message"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's let
, not const
Current JavaScript standards encourage us to use of let and const instead.