I know I can call top-level functions defined in JS from VBScript, and vice versa, like this:
<%@ language=\"Chakra\" %>
I don't know how to avoid the problem that VBScript cannot directly call a Javascript "constructor" function. The way I dealt with it was to simply define a shim: a top-level function in Javascript that invokes the constructor from within Javascript and returns the reference.
So:
<script language='javascript' runat='server'>(function() {
MyObj = function() {
this.foo = ...
...
};
MyObj.prototype.method1 = function() { .. };
MyObj.prototype.method2 = function() { .. };
// define a shim that is accessible to vbscript
Shim = {construct: function() { return new MyObj(); } };
}());
</script>
<script language='vbscript' runat='server'>
Dim foo
Set foo = Shim.construct()
...
</script>