Giter Club home page Giter Club logo

eeui-plugin-deviceinfo's Introduction

设备信息

安装

eeui plugin install https://github.com/aipaw/eeui-plugin-deviceInfo

卸载

eeui plugin uninstall https://github.com/aipaw/eeui-plugin-deviceInfo

引用

const deviceInfo = app.requireModule("eeui/deviceInfo");

info(callback) 获取信息

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • model (String)

    • vendor (String)

    • uuid (String)

    • platform (String) (Android | iOS)

    • version (String)

    • language (String)

    • isVirtual (Boolean) ( iOS Only )

示例

deviceInfo.info((ret) => {
    console.log(ret)
})

netStatus(callback) 获取网络状态

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • type (String) (wifi | 3g | 4g | 2g | unkown)

示例

deviceInfo.netStatus((ret) => {
    console.log(ret)
})

setVibrate(time) 振动

参数

  1. [time] (Int) (ms, default: 500) ( Android Only )

示例

deviceInfo.setVibrate()
deviceInfo.setVibrate(2000)

screenInfo(callback) 获取屏幕信息

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • height (Int)

    • width (Int)

    • scale (Float)

    • dpiX (Int)

    • dpiY (Int)

示例

deviceInfo.screenInfo((ret) => {
    console.log(ret)
})

getBrightness(callback) 获取屏幕亮度

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • brightness (Float) (0~1)

示例

deviceInfo.getBrightness((ret) => {
    console.log(ret)
})

setBrightness(value, callback) 设置屏幕亮度

参数

  1. value (Float) (0~1)

  2. [callback] (Function)

返回

  1. result (Object)
    • brightness (Float) (0~1)

示例

deviceInfo.setBrightness(1)
deviceInfo.setBrightness(1, (ret) => {
    console.log(ret)
})

getOrientation(callback) 获取屏幕方向状态

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • orientation (String) (portrait | landscape | landscape-left | landscape-right | portrait-down)

示例

deviceInfo.getOrientation((ret) => {
    console.log(ret)
})

getVolume(callback) 获取音量

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • volume (Float) (0~1)

示例

deviceInfo.getVolume((ret) => {
    console.log(ret)
})

setVolume(value, callback) 设置音量

参数

  1. value (Float) (0~1)

  2. [callback] (Function)

返回

  1. result (Object)
    • volume (Float) (0~1)

示例

deviceInfo.setVolume(1)
deviceInfo.setVolume(1, (ret) => {
    console.log(ret)
})

batteryStatus(callback) 获取电池状态

参数

  1. [callback] (Function)

返回

  1. result (Object)
    • level (Int) (0~100)

    • isPlugged (Boolean)

示例

deviceInfo.batteryStatus((ret) => {
    console.log(ret)
})

eeui-plugin-deviceinfo's People

Contributors

aipaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vebin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.