From cfd654c1b24f1e7fdede6cbb42a85e7c12b52ef9 Mon Sep 17 00:00:00 2001 From: Artsiom Trubchyk Date: Fri, 5 Feb 2021 21:07:40 +0300 Subject: [PATCH] Optimize helper.lua --- druid/helper.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/druid/helper.lua b/druid/helper.lua index 590f5ae..71233ef 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -5,6 +5,7 @@ local const = require("druid.const") local M = {} +local system_name = sys.get_sys_info().system_name --- Text node or icon node can be nil local function get_text_width(text_node) @@ -182,15 +183,13 @@ end --- Check if device is mobile (Android or iOS) -- @function helper..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 --- Check if device is HTML5 -- @function helper.is_web function M.is_web() - local system_name = sys.get_sys_info().system_name return system_name == const.OS.BROWSER end