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

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>