mirror of
https://github.com/wangjunget/cordova-plugin-statusbar-height.git
synced 2026-04-22 00:00:03 +08:00
create project
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
var exec = require('cordova/exec');
|
||||
|
||||
// 对外开放接, 回调函数接收状态栏高度值, 设备独立像素值
|
||||
exports.getValue = function(success, error) {
|
||||
// android px to pd
|
||||
// android 返回px值
|
||||
// ios 返回pt值
|
||||
function pxToPd(value) {
|
||||
var pdr = window.devicePixelRatio;
|
||||
var pd = value / pdr;
|
||||
if (cordova.platformId == 'android') {
|
||||
success(pd)
|
||||
} else {
|
||||
success(value)
|
||||
}
|
||||
}
|
||||
exec(pxToPd, error, 'StatusBarHeight', 'getValue', []);
|
||||
}
|
||||
Reference in New Issue
Block a user