How to create properly event and callback: should I use EventListener ?

29 views
Skip to first unread message

rev...@gmail.com

unread,
May 14, 2013, 11:47:32 AM5/14/13
to shar...@googlegroups.com
Hi,

I use a javascript framework wich use events like this :
"
document.addEventListener('contacts_choose', onChooseContact);
function onChooseContact(evt) {...}
"
What is the correct implementation in C# (in order to make a wrapper) ? If I use addEventListener, I must use EventListener, but how ?

Thanks,
Hervé

Dan-el Khen

unread,
May 15, 2013, 4:12:16 AM5/15/13
to shar...@googlegroups.com
Hi,
It should go something like this:
    [JsType(JsMode.Prototype)]
    public class Document
    {
        public void addEventListener(JsString name, JsAction<MyFrameworkEventArgs> handler)
        {
        }
    }

    [JsType(JsMode.Prototype)]
    public class MyFrameworkEventArgs
    {
    }

    [JsType(JsMode.Global)]
    public class MyFrameworkContext
    {
        public static JsString document { get; set; }
    }

If you need more help with this let me know...

Cheers
Dan-el



--
You received this message because you are subscribed to the Google Groups "SharpKit Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharpkit+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages