Skip to content

Commit

Permalink
refactor: use compatible system info API
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-huxiyang committed Feb 8, 2025
1 parent fe9f1a9 commit 3ed3a50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/get-system-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface IDeviceInfo
* 获取设备基础信息,兼容新旧 API
* @returns {IDeviceInfo} 设备基础信息
*/
export function getDeviceInfo(): IDeviceInfo {
export const getDeviceInfo = (): IDeviceInfo => {
return Taro.canIUse('getDeviceInfo')
? Taro.getDeviceInfo()
: Taro.getSystemInfoSync()
Expand All @@ -17,7 +17,7 @@ export function getDeviceInfo(): IDeviceInfo {
* 获取窗口信息,兼容新旧 API
* @returns {Taro.getWindowInfo.Result} 窗口信息
*/
export function getWindowInfo(): Taro.getWindowInfo.Result {
export const getWindowInfo = (): Taro.getWindowInfo.Result => {
return Taro.canIUse('getWindowInfo')
? Taro.getWindowInfo()
: Taro.getSystemInfoSync()
Expand All @@ -27,7 +27,7 @@ export function getWindowInfo(): Taro.getWindowInfo.Result {
* 获取应用基础信息,兼容新旧 API
* @returns {Taro.getAppBaseInfo.Result} 应用基础信息
*/
export function getAppBaseInfo(): Taro.getAppBaseInfo.Result {
export const getAppBaseInfo = (): Taro.getAppBaseInfo.Result => {
return Taro.canIUse('getAppBaseInfo')
? Taro.getAppBaseInfo()
: Taro.getSystemInfoSync()
Expand Down

0 comments on commit 3ed3a50

Please sign in to comment.