remove code

This commit is contained in:
Suresh, Kamlesh 2020-08-25 19:32:48 -04:00
parent f67b8a644d
commit f3c3ba9799

View File

@ -134,25 +134,26 @@ extension WebView : WKUIDelegate {
while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred". while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred".
so webView.isLoading to check load finished state so webView.isLoading to check load finished state
*/ */
webView.evaluateJavaScript("document.readyState", completionHandler: { (complete, error) in if !webView.isLoading {
if complete == nil { webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [weak self] (result, error) in
return guard let self = self else {
} return
webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [weak self] (result, error) in }
guard let self = self else { MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
return let scrollHeight = webView.scrollView.contentSize.height
} guard let self = self else {
let scrollHeight = webView.scrollView.contentSize.height return
if let height = result as? CGFloat, }
height < scrollHeight { if let height = result as? CGFloat {
self.webViewHeight?.constant = height self.webViewHeight?.constant = height
} else { } else {
//if failed to get height from javascript, using scrollview.contensize's height //if failed to get height from javascript, using scrollview.contensize's height
self.webViewHeight?.constant = scrollHeight self.webViewHeight?.constant = scrollHeight
} }
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
}) })
}) })
}
} }