diff --git a/src/windows/StatusBarProxy.js b/src/windows/StatusBarProxy.js index 1755fb7..3929ff0 100644 --- a/src/windows/StatusBarProxy.js +++ b/src/windows/StatusBarProxy.js @@ -55,9 +55,11 @@ function hexToRgb(hex) { module.exports = { _ready: function(win, fail) { - win(statusBar.occludedRect.height !== 0); + if(isSupported()) { + var statusBar = getViewStatusBar(); + win(statusBar.occludedRect.height !== 0); + } }, - overlaysWebView: function () { // not supported }, diff --git a/www/statusbar.js b/www/statusbar.js index afef7dd..d9d0ea5 100644 --- a/www/statusbar.js +++ b/www/statusbar.js @@ -97,15 +97,17 @@ var StatusBar = { }; -// prime it -exec(function (res) { - if (typeof res == 'object') { - if (res.type == 'tap') { - cordova.fireWindowEvent('statusTap'); +// prime it. setTimeout so that proxy gets time to init +window.setTimeout(function () { + exec(function (res) { + if (typeof res == 'object') { + if (res.type == 'tap') { + cordova.fireWindowEvent('statusTap'); + } + } else { + StatusBar.isVisible = res; } - } else { - StatusBar.isVisible = res; - } -}, null, "StatusBar", "_ready", []); + }, null, "StatusBar", "_ready", []); +}, 0); module.exports = StatusBar;