This project has moved and is read-only. For the latest updates, please go here.

global object - types

Nov 14, 2015 at 5:27 PM

i know you can add a global object like in browser - window

so is it possible to add types to this object?

so something like -

Nov 16, 2015 at 4:26 AM
Edited Nov 16, 2015 at 4:30 AM
Hi furesoft,

You can use ClearScript's ExtendedHostFunctions for this purpose. Here's a sample:
public class XmlHttpRequest {
    public static void SomeMethod() {
        // code goes here
public class Globals {
    private readonly ExtendedHostFunctions _extHost = new ExtendedHostFunctions();
    public object XmlHttpRequest {
        get { return _extHost.type(typeof(XmlHttpRequest)); }
And then:
engine.Script.globals = new Globals();
Good luck!