Use const and let for platform object
This commit is contained in:
parent
85dc6b9bd8
commit
2ed3e76ab2
1 changed files with 7 additions and 7 deletions
|
@ -4,14 +4,14 @@
|
|||
|
||||
utils.platform = {
|
||||
platform: function () {
|
||||
var version, webkitVersion
|
||||
var platform = {}
|
||||
let platform = {}
|
||||
|
||||
var userAgent = (navigator.userAgent).toLowerCase()
|
||||
var language = navigator.language || navigator.browserLanguage
|
||||
const userAgent = (navigator.userAgent).toLowerCase()
|
||||
const language = navigator.language || navigator.browserLanguage
|
||||
|
||||
const version = platform.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[/: ](.+?)([ );]|$)/) || [])[1]
|
||||
const webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1]
|
||||
|
||||
version = platform.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[/: ](.+?)([ );]|$)/) || [])[1]
|
||||
webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1]
|
||||
platform.windows = platform.isWindows = !!/windows/.test(userAgent)
|
||||
platform.mac = platform.isMac = !!/macintosh/.test(userAgent) || (/mac os x/.test(userAgent) && !/like mac os x/.test(userAgent))
|
||||
platform.lion = platform.isLion = !!(/mac os x 10_7/.test(userAgent) && !/like mac os x 10_7/.test(userAgent))
|
||||
|
@ -47,7 +47,7 @@ utils.platform = {
|
|||
platform.msie ? 'msie' : platform.mozilla ? 'mozilla' : platform.chrome ? 'chrome' : platform.safari ? 'safari' : platform.opera ? 'opera' : platform.mobileSafari ? 'mobile-safari' : platform.android ? 'android' : 'unknown'
|
||||
|
||||
function platformName (candidates) {
|
||||
for (var i = 0; i < candidates.length; i++) {
|
||||
for (let i = 0; i < candidates.length; i++) {
|
||||
if (candidates[i] in window) {
|
||||
return 'window.' + candidates[i]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue