caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>
To: Helmut Brandl <helmut.brandl@gmx.net>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Beginners Question for js_of_ocaml
Date: Sat, 14 Jan 2017 08:49:27 +0100	[thread overview]
Message-ID: <CADK7aFOWmi+=HL9oU2nMiD14mJsCzGfdHcRUqa2GtZez7CXc8g@mail.gmail.com> (raw)
In-Reply-To: <91217907-3b9e-9977-79cc-fc29fe7a290d@gmx.net>

[-- Attachment #1: Type: text/plain, Size: 1447 bytes --]

Hi Helmut,

I am a js_of_ocaml beginner, but it sounds like you could do it using :

  Js.Unsafe.fun_call (Js.Unsafe.js_expr "readdirSync") [| .. args , wrapped
with Js.Unsafe.inject .. |]

You can look at the docs at
https://ocsigen.org/js_of_ocaml/2.8.3/manual/bindings, especially under
"Binding a JS function", where there is an example with the function
"decodeURI".

Cheers!

Best wishes,
Nicolas





On Sat, Jan 14, 2017 at 12:58 AM, Helmut Brandl <helmut.brandl@gmx.net>
wrote:

> Hello List,
>
> I am trying to use js_of_ocaml to compile my ocaml project for the nodejs
> ecosystem. Since js_of_ocaml does not compile calls to the 'unix' library I
> have to call some javascript functions directly from ocaml. All I need is
> to be able to call the javascript functions
>
> - readdirSync
> - mkdirSync
> - rmdirSync
> - statSync
>
> and receive the results in ocaml.
>
> I have looked into the documentation and into the examples, but I have not
> found a way on how to do this. All examples are for use in the browser.
> Maybe its a stupid question and it is so simple that I, as a beginner in
> js_of_ocaml, just don't see it.
>
> Can anybody give me a hint? Thanks in advance.
>
> Regards
> Helmut
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2459 bytes --]

  reply	other threads:[~2017-01-14  7:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 23:58 Helmut Brandl
2017-01-14  7:49 ` Nicolás Ojeda Bär [this message]
2017-01-14 18:16   ` Philippe Veber
2017-01-16 14:30     ` Helmut Brandl
2017-01-16 14:24   ` Helmut Brandl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADK7aFOWmi+=HL9oU2nMiD14mJsCzGfdHcRUqa2GtZez7CXc8g@mail.gmail.com' \
    --to=nicolas.ojeda.bar@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=helmut.brandl@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).