[Ur] Passing non-Basis data types to javascript ffi?

Daniel Patterson dbp at dbpmail.net
Mon Mar 11 19:51:01 EDT 2013


Based on discussions / suggestions earlier, I'm trying to do the following:

1. create sources with change listeners
2. pass them, along with the functions that can update them, to the
javascript ffi
3. trigger those updates in javascript code, which should in turn trigger
the change handlers written with ur/web.

(the reasons for this is that the little app I've been experimenting with
does a bit with html5 video... which is browser dependent, depends on very
new javascript apis, etc...)

As far as I understand this, in principle this should be possible - execF
in javascript land should be able to call the update function, and records,
sources, and functions are all representable in javascript, so I should be
able to pass these special sources back and forth. My problem is just
writing the type signature for the FFI signature file - as mentioned in the
other thread, it seems like sourceL.ur from the meta repository will work
for what I want, and so the signature I want to write is:

val init : id -> (* id for player container *)
           SourceL.t float -> (* offset source *)
           (SourceL.t float -> float -> transaction unit) -> (* set
function *)
           url -> (* video url *)
           url -> (* audio url *)
           transaction unit

Which fails, because the signature file doesn't know what I mean by
SourceL. How can I get that in scope, or is this just not possible (because
I've overestimated what I can get into javascript)? (I've tried some
monkeying with `library`, creating an urp file, etc - with no luck).

Thanks!
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20130311/024cfbdd/attachment.html>


More information about the Ur mailing list