-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add function "open_t" #2
base: master
Are you sure you want to change the base?
Conversation
cordova_in_app_browser.mli
Outdated
|
||
(*[@@@js.implem*) | ||
|
||
open Js_of_ocaml.Dom_html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Au lieu d'un open
...
cordova_in_app_browser.mli
Outdated
val addEventListener : | ||
t -> (*Where to add the listener*) | ||
string -> (*The event type*) | ||
(event -> unit) -> (*The call_back*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... essaye Js_of_ocaml.Dom_html.event
ici.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'avais déjà essayé, le problème restait le même à la seule différence que le message indiquait que "Js_of_ocaml.Dom_html.event_of_js" n'existe pas.
<<
File "cordova_in_app_browser.ml", line 163, characters 47-79:
163 | (Js_of_ocaml.Dom_html.event_of_js
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound value Js_of_ocaml.Dom_html.event_of_js
make: *** [Makefile:17: build] Error 2
cordova_in_app_browser.mli
Outdated
val addEventListener : | ||
t -> (*Where to add the listener*) | ||
string -> (*The event type*) | ||
(event -> unit) -> (*The call_back*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dannywillems Hello Danny !
Would you know whether/how one can use a type like Js_of_ocaml.Dom_html.event
in gen_js_api ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if I understand correctly the question, but if the function is expecting an event, simply using Js_of_ocaml.Dom_html.event
should be enough shouldn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately things are not that simple. Simply using Js_of_ocaml.Dom_html.event
will result in gen_js_api
generating Js_of_ocaml.Dom_html.event_of_js
.
So it seems that one would need to supply a transformation function. I've tried all kinds of stuff already, but to no avail yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Ojs.t?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tried, ugly, and not sure it is the best idea:
type event = Ojs.t
[@@@js.stop]
val of_dom_html : Js_of_ocaml.Dom_html.event -> event
val to_dom_html : event -> Js_of_ocaml.Dom_html.event
[@@@js.start]
[@@@js.implem
let of_dom_html x = Obj.magic x
let to_dom_html x = Obj.magic x]
val addEventListener : t -> string -> (event -> unit) -> unit [@@js.call]
First, thanks for your contribution! The OCaml ecosystem changed quite a lot since the beginning of this project (dune, ocamlformat, merlin and OPAM are more mature, etc). I'd like to update to the new ecosystem gradually, and add CI (GitHub actions). |
@Thibaut-Gudin Will do! |
Thanks! Very helpful! |
I tried to import "#3" with the BeSport app and it seems that their is no problem with the compilation. I'm not entirely sure if I made it correctly so I will precise what I done in order to testing with the #3 in local: Then I tried to compile everything and the compilation seems to succeed. |
This would make more sense:
|
Also: |
I tried this command line but the cmd return an error: << |
|
I already test all the function I added on practice, they all seems to works, I tried to add commentary to explain what I added, however I haven't add anything in the "README". |
Sorry, I realise their maybe something that I had to add later in the library. |
fe7f37b
to
7388b7c
Compare
dune dependency fixup
opam file fixup
Is it ready to be reviewed? |
README.md
Outdated
@@ -56,3 +56,33 @@ Cordova_in_app_browser.ai_clear_cache true] in | |||
(* Opens in the Cordova WebView if the URL is in the white list *) | |||
i#open_ "https://ocaml.org" (Cordova_in_app_browser.target_self) opt | |||
``` | |||
|
|||
The function "open_t" is hte same as "open" but it return a "typed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this pull-request for the correction and if others corrections are needed for the README:
besport#3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(@dannywillems No, it's not yet ready to be reviewed yet.)
Readme fixup
@dannywillems Alright, I'd say this PR is ready for review. |
Actually no, the commits should be squashed first. (@Thibaut-Gudin) |
See besport#4 |
No description provided.