cordova-plugin-inappbrowserの"message"イベント
cordova-plugin-inappbrowser "message"イベントでネイティブ側で処理
非常に役に立つ"message"イベント。
これを使えばinappbrowser側でのイベントをひっかけてネイティブにもってこれる。
cordova側の処理。
this.Ref.addEventListener("message", function(event){
var type = event.type;
});
とても楽。
呼び出す側。
if (window.webkit && window.webkit.messageHandlers) {
var messageObj = {
"type": type
, "data" : data
};
var stringifiedMessageObj = JSON.stringify(messageObj);
webkit.messageHandlers.cordova_iab.postMessage(stringifiedMessageObj);
}
とても楽。
渡すパラメータはjsonにしてやるみたいでござるよ。
注意すべきはAndroid時の挙動か。
window.webkitはネイティブ側のonなんたらFinishイベントで捏造しているくさい。
document.readyとかでイベントはしらせたら多分はしらない。たぶんね。
(cordova_iabというオブジェクトを直で使えば動かせるかも)
Author And Source
この問題について(cordova-plugin-inappbrowserの"message"イベント), 我々は、より多くの情報をここで見つけました https://qiita.com/ookishin2018/items/1ba5dd0924373b67977e著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .