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

New Post: global object - types

$
0
0
Hi furesoft,

You can use ClearScript's ExtendedHostFunctions for this purpose. Here's a sample:
publicclass XmlHttpRequest {
    publicstaticvoid SomeMethod() {
        // code goes here
    }
}
publicclass Globals {
    privatereadonly ExtendedHostFunctions _extHost = new ExtendedHostFunctions();
    publicobject XmlHttpRequest {
        get { return _extHost.type(typeof(XmlHttpRequest)); }
    }
}
And then:
engine.Script.globals = new Globals();
engine.Execute("globals.XmlHttpRequest.SomeMethod()");
Good luck!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images