Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Is it possible to expose a JavaScript style function with a callback in clearscript

0
0
I would like to expose an open method on my c# object that I am exposing to ClearScript. The open method signature would look like this
    public void open(string address, Action<dynamic> callback)
    {
        if (callback != null)
        {
            callback("success");
        }
    }
And calling it from script like this
page.open('http://www.cnn.com', function(status) { 
    // do somthing here with status
});

Viewing all articles
Browse latest Browse all 2297