Просмотр исходного кода

Update webview manual post-WKWebView (#80)

WKWebView returns eval results as Foundation.framework primitives (NSNumber, NSString, etc), which serialise differently. As a result, JS `true` is returned as a `NSNumber` which serialises as `1`, when converted to a string.
Marius Petcu 5 лет назад
Родитель
Сommit
e5777358fc
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      docs/en/manuals/webview.md

+ 2 - 2
docs/en/manuals/webview.md

@@ -308,9 +308,9 @@ local function webview_callback(self, webview_id, request_id, type, data)
     if type == webview.CALLBACK_RESULT_EVAL_OK and
         request_id == self.closeCheckRequest then
 
-        -- Compare the JavaScript result, if it's "true" we should
+        -- Compare the JavaScript result, if it's "true" (or "1" on iOS) we should
         -- close the webview!
-        if data.result == "true" then
+        if data.result == "true" or data.result == "1" then
             webview.destroy(webview_id)
         end