Optimize helper.lua

This commit is contained in:
Artsiom Trubchyk 2021-02-05 21:07:40 +03:00 committed by GitHub
parent 4e65895966
commit cfd654c1b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ local const = require("druid.const")
local M = {} local M = {}
local system_name = sys.get_sys_info().system_name
--- Text node or icon node can be nil --- Text node or icon node can be nil
local function get_text_width(text_node) local function get_text_width(text_node)
@ -182,15 +183,13 @@ end
--- Check if device is mobile (Android or iOS) --- Check if device is mobile (Android or iOS)
-- @function helper..is_mobile -- @function helper..is_mobile
function M.is_mobile() function M.is_mobile()
local system_name = sys.get_sys_info().system_name return system_name == const.OS.IOS or SYSTEM_NAME == const.OS.ANDROID
return system_name == const.OS.IOS or system_name == const.OS.ANDROID
end end
--- Check if device is HTML5 --- Check if device is HTML5
-- @function helper.is_web -- @function helper.is_web
function M.is_web() function M.is_web()
local system_name = sys.get_sys_info().system_name
return system_name == const.OS.BROWSER return system_name == const.OS.BROWSER
end end