Let platform be a self-invoked function

This commit is contained in:
Christoph Diehl 2017-06-08 15:49:58 +02:00
parent d7db764361
commit 3ad70863f1

View file

@ -45,7 +45,7 @@ utils.platform = (function () {
platform.current = platform.current =
platform.msie ? 'msie' : platform.mozilla ? 'mozilla' : platform.chrome ? 'chrome' : platform.safari ? 'safari' : platform.opera ? 'opera' : platform.mobileSafari ? 'mobile-safari' : platform.android ? 'android' : 'unknown' 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) { function platformName (candidates) {
for (let i = 0; i < candidates.length; i++) { for (let i = 0; i < candidates.length; i++) {
if (candidates[i] in window) { if (candidates[i] in window) {
return 'window.' + candidates[i] return 'window.' + candidates[i]