[Ur] Minimal attempt to wrap a datepicker library (Pikaday). What do I put in js.urs ?

Stefan Scott Alexander stefanscottalexx at gmail.com
Sun Aug 2 00:49:51 EDT 2015


Hi -

I have created a repo containing a minimal attempt to wrap the datepicker
library Pikaday (which uses no external JavaScript libraries or Bootstrap):

  https://github.com/StefanScott/urweb-wrap-pikaday

I can't figure out what to put in file:

  js.urs

If I leave that file empty, the program compiles and runs, but of course no
calendar displays when you click in the textbox.

The file js.urs should possibly contain something like the following:

  val Pikaday : ??? -> transaction unit

Questions:

(1) Line 404 of file pikaday.js defines a function:

  https://github.com/dbushell/Pikaday/blob/master/pikaday.js#L404

  Pikaday = function(options) ...

This raises a couple of questions:

(1)(a) Is this indeed the (only) function that should be declared in js.urs
?

(1)(b) The function in pikaday.js starts with a capital letter. But a
function in Ur/Web cannot start with a capital letter, correct? If so, then
how can I wrap such a function, to use with Ur/Web?

(2) The function Pikaday in file pikaday.js takes an argument called
'options'.

What is the *type* of this argument (to insert above, where the '???' is)?

Thanks for any help!

###
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150802/d4ab5d7b/attachment.html>


More information about the Ur mailing list