According to the mozilla foundation, core javascript consist of the following objects:
Array
Boolean
Date
Error
Function
java
JavaArray
JavaClass
JavaObject
JavaPackage
Math
netscape
Number
Object
Packages
RegExp
String
sun
But that is
their core. The real core consists of:
Array
Boolean
Date
Error
Function
Math
Number
Object
RegExp
String
Those are the only objects you can trust to be in any javascript enabled program. And UltraEdit added the 3 objects mofi mentioned earlier. ActiveXObject has never and will never be a part of core javascript nor will WScript. They are very platform specific objects, and ActiveXObject will only work in an ActiveX supporting browser (=Internet Explorer).
This is also by design. Javascript does not have the capabilities to access the file system. That you are able to create a new file with javascript in UE is because the developers extended the core javascript with it's own object, which hooks javascript to the file system. As such it would be possible for the developers to create such a hook to COM objects. But it is very unlikely that this will happen any time soon. I think javascript is introduced step by step in UltraEdit.
so yes mofi, it is possbile to create new objects
- Code: Select all
var o = new Object();
o.foo = 'hello';
UltraEdit.outputWindow.write(o.foo);
or even complete prototyped classes if you wish to do so.
- Code: Select all
function Foo(nr1, nr2)
{
this.nr1 = parseInt(nr1);
this.nr2 = parseInt(nr2);
}
Foo.prototype.nr1 = ''; // instance var
Foo.prototype.nr2 = ''; // instance var
Foo.version = '1'; // static var
Foo.prototype.add = function()
{
return String(this.nr1 + this.nr2)
}
var bar1 = new Foo(10, 10);
var bar2 = new Foo(3, 3);
UltraEdit.outputWindow.write(Foo.version);
UltraEdit.outputWindow.write(bar1.add());
UltraEdit.outputWindow.write(bar2.add());