Skip to content

Commit

Permalink
adding open 'typed' and InAppBrowser functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaut committed Jul 2, 2021
1 parent 3a23301 commit 14f4e5c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 207 deletions.
2 changes: 2 additions & 0 deletions cordova-plugin-inappbrowser.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ build: [[ "dune" "build" "-j" jobs "-p" name "@install" ]]
depends: [
"ocaml" { >= "4.03.0" }
"gen_js_api"
"js_of_ocaml" {>= "3.8.0" & < "3.9.0"}
"js_of_ocaml-ppx" {>= "3.8.0" & < "3.9.0"}
]
205 changes: 0 additions & 205 deletions cordova_in_app_browser.mli

This file was deleted.

31 changes: 31 additions & 0 deletions src/cordova_in_app_browser.mli
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,34 @@ val open_ :
(* Options for the InAppBrowser *)
unit
[@@js.global "cordova.InAppBrowser.open"]

(*Function that allow to use "InAppBrowser" object*)
type inAppBrowser

(*Same as "open_" but return a "typed" result: an "InAppBrowser" result*)
val open_t : url:string -> tgt:target -> option:string -> inAppBrowser
[@@js.global "cordova.InAppBrowser.open"]

val addEventListener :
inAppBrowser ->
(*Where to add the listener*)
eventname:string ->
(*The event name*)
f:(Ojs.t -> unit) ->
(*The call_back*)
unit
[@@js.call]

val close : inAppBrowser -> unit [@@js.call]

(*That function indicate if the plugin "cordova-InAppBrowser" is currently available*)
[@@@js.stop]

val plugin_available : unit -> bool

[@@@js.start]

[@@@js.implem
let plugin_available () =
Js_of_ocaml.Js.Optdef.test
Js_of_ocaml.Js.Unsafe.global##.cordova##._InAppBrowser]
4 changes: 2 additions & 2 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
(public_name cordova-plugin-inappbrowser)
(name cordova_in_app_browser)
(modes byte)
(libraries gen_js_api)
; (preprocess (pps gen_js_api))
(libraries gen_js_api js_of_ocaml js_of_ocaml-ppx)
(preprocess (pps js_of_ocaml-ppx))
)

0 comments on commit 14f4e5c

Please sign in to comment.