Last active
September 21, 2021 00:56
-
-
Save marchbold/c052b5ff35f6e2c3a090 to your computer and use it in GitHub Desktop.
AirBridge Javascript helper to communicate from JS to the WebView instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
*/ | |
var AirBridge = (function() { | |
var instance; | |
function createInstance() { | |
var object = new Object(); | |
object.useWindowLocation = true; | |
return object; | |
} | |
return { | |
setUseWindowLocation: function( $shouldUseWindowLocation ) { | |
if (!instance) { | |
instance = createInstance(); | |
} | |
instance.useWindowLocation = $shouldUseWindowLocation; | |
}, | |
message: function( $message ) { | |
if (!instance) { | |
instance = createInstance(); | |
} | |
if (!instance.useWindowLocation) { | |
NativeWebView.airBridge( $message ); | |
} | |
else { | |
window.location = "airBridge:" + $message; | |
} | |
} | |
}; | |
})(); | |
// com.distriqt.NativeWebView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need this function maybe:
var sys = getMobileOperatingSystem();