2016-08-03 13:15:04 +00:00
|
|
|
(function () {
|
2018-07-06 19:47:59 +00:00
|
|
|
var history = window.history;
|
|
|
|
var pushState = history.pushState;
|
|
|
|
history.pushState = function(state) {
|
|
|
|
setTimeout(function () {
|
|
|
|
WebViewBridge.send(JSON.stringify({
|
|
|
|
type: 'navStateChange',
|
|
|
|
navState: { url: location.href, title: document.title }
|
|
|
|
}))
|
|
|
|
}, 100);
|
|
|
|
return pushState.apply(history, arguments);
|
|
|
|
};
|
2016-08-03 13:15:04 +00:00
|
|
|
|
|
|
|
WebViewBridge.onMessage = function (messageString) {
|
|
|
|
console.log("received from react-native: " + messageString);
|
2017-04-29 11:08:49 +00:00
|
|
|
|
2018-05-23 13:54:24 +00:00
|
|
|
if (messageString === "navigate-to-blank")
|
|
|
|
window.location.href = "about:blank";
|
2016-08-03 13:15:04 +00:00
|
|
|
};
|
|
|
|
}());
|