From ba827ceeff6c5a0c735a7ff172326ff9826d27c5 Mon Sep 17 00:00:00 2001 From: wells Date: Wed, 17 May 2017 10:47:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#14=20fix=20=E4=B8=BB=E9=A1=B5=E5=86=85?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=89javascript=EF=BC=8C=E4=BC=9A?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppIcon.appiconset/Contents.json | 25 +++++++++++++++++++ .../WBWebBrowserJSBridge.bundle/wbjs.js | 19 ++++++++++---- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Examples/WKWebView+WBWebViewConsole/WKWebView+WBWebViewConsole/Images.xcassets/AppIcon.appiconset/Contents.json b/Examples/WKWebView+WBWebViewConsole/WKWebView+WBWebViewConsole/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..1d060ed 100644 --- a/Examples/WKWebView+WBWebViewConsole/WKWebView+WBWebViewConsole/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Examples/WKWebView+WBWebViewConsole/WKWebView+WBWebViewConsole/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -59,6 +79,11 @@ "idiom" : "ipad", "size" : "76x76", "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" } ], "info" : { diff --git a/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js b/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js index 626af5a..16fa50e 100644 --- a/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js +++ b/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js @@ -1,4 +1,4 @@ -/** +/** * Copyright (c) 2014-present, Weibo, Corp. * All rights reserved. * @@ -23,7 +23,7 @@ document.dispatchEvent(readyEvent); } } - } (this, function () { + }(this, function () { var _callbacks = []; var _callbackIndex = 1000; @@ -51,10 +51,19 @@ action: name, params: params, callback_id: callbackID - } + }; _messageQueue.push(message); - location.href = _invokeScheme; + // Listen for DOMContentLoaded and notify our channel subscribers. + if (document.readyState == 'complete' || document.readyState == 'interactive') { + location.href = _invokeScheme; + } else { + document.addEventListener('DOMContentLoaded', function () { + if(_messageQueue.length > 0) { + location.href = _invokeScheme; + } + }, false); + } }, _messageQueue: function () { @@ -77,7 +86,7 @@ if (callback) { var params = message.params; var success = !message.failed; - + callback(params, success); } } From 84b1eff1e02b813c6875039497c61ed374176f84 Mon Sep 17 00:00:00 2001 From: wells Date: Fri, 2 Jun 2017 17:30:13 +0800 Subject: [PATCH 2/2] f --- .../JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js b/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js index 16fa50e..bcf9d37 100644 --- a/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js +++ b/WBWebViewConsole/Supports/WBWebView/JSBridge/Resources/WBWebBrowserJSBridge.bundle/wbjs.js @@ -60,7 +60,9 @@ } else { document.addEventListener('DOMContentLoaded', function () { if(_messageQueue.length > 0) { - location.href = _invokeScheme; + setTimeout(function(){ + location.href = _invokeScheme; + }, 3000); } }, false); } @@ -94,4 +96,4 @@ return Weibo; })); -}) \ No newline at end of file +})