[Opa] can't register two consecutive dom event handlers

Adam Koprowski Adam.Koprowski at mlstate.com
Tue Feb 7 08:15:45 UTC 2012


  Alok,

  Indeed, Nicolas is right. You can also use:

function my_log(s) {
  Log.warning("XXX", s);
}

  if you like.

  Best,
  Adam

P.S. I know a runtime error is somehow disappointing; not sure whether we
can do any better here, though. Forwarding to Rudy who knows much more
about serialization than I do.

On Tue, Feb 7, 2012 at 08:54, Nicolas Glondu <nicolas.glondu at mlstate.com>wrote:

> I think the problem is not coming from the event handler.
>
> This works perfectly (I only changed the "my_log" function) :
>
>
> function init() {
>  _ = Dom.bind(#x, {mousedown}, function(_){my_log("Toto")})
>  _ = Dom.bind(#x, {mouseup}, function(_){my_log("Titi")})
>  void
> }
>
> function my_log(s) {
>  jlog(s)
>
> }
>
> function start() {
> <div id=#x onready={function(_) { init() }} style="width: 400px; height:
> 400px; border: 1px solid black;"/>
> }
> Server.start(
>   Server.http,
>   {
>     page: start,
>     title: "Hello, world"
>   }
> )
>
> The version with "Debug.warning" makes js errors on loading and on
> clicking the box.
>
> --
> Nicolas G
> ______________________________**_________________
> Opa mailing list
> Opa at lists.owasp.org
> https://lists.owasp.org/**mailman/listinfo/opa<https://lists.owasp.org/mailman/listinfo/opa>
>



-- 
*Adam Koprowski                [http://adam-koprowski.net]
Opa Tech Evangelist @ MLstate [http://opalang.org | http://mlstate.com]*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.owasp.org/pipermail/opa/attachments/20120207/e3361e92/attachment-0001.html>


More information about the Opa mailing list