Skip to content

Commit

Permalink
adding functions to access 'InAppBrowserEvent' properties + README up…
Browse files Browse the repository at this point in the history
…dated v2
  • Loading branch information
Thibaut committed Jul 5, 2021
1 parent a2c7a4a commit 7d83758
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,21 @@ let popup =
~url:"https://www.google.com" ~tgt:Blank
~option:"location=yes"
in
Cordova_in_app_browser.addEventListener popup
~eventname:"loadstop" ~f:(fun evt ->
ignore
(print_endline
"Hello
World");
Cordova_in_app_browser.close
popup)
Cordova_in_app_browser.addEventListener popup ~eventname:"loadstop"
~f:(fun evt ->
ignore (print_endline "Hello World");
Cordova_in_app_browser.close popup)
```

You can access the 5 properties of the argument of an added
"EventListener" with this functions:
°Cordova_in_app_browser.type: either "loadstart",
"loadstop", "loaderror", "message", or "exit"
°Cordova_in_app_browser.url: not available for every
type (not for "exit").
event type (not for "exit").
°Cordova_in_app_browser.code: only available for event
with an error code.
°Cordova_in_app_browser.message: only available for
"loaderror" type
"loaderror" event type
°Cordova_in_app_browser.data: onlys available for
"message" type
"message event type
4 changes: 1 addition & 3 deletions src/cordova_in_app_browser.mli
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ val code : inAppBrowserEvent -> int [@@js.get "code"]

val message : inAppBrowserEvent -> string [@@js.get "message"]

type d

val data : inAppBrowserEvent -> d [@@js.get "data"]
val data : inAppBrowserEvent -> string [@@js.get "data"]

(*Indicate to close an open InAppBrowser object*)
val close : inAppBrowser -> unit [@@js.call]
Expand Down

0 comments on commit 7d83758

Please sign in to comment.