I've been scripting for quite awhile and I don't know what the *bleep* ECMAScript is. I doubt anyone knew to coding would either.
I even dislike the syntax of the example you provided. I think catchevent() works just fine and should be expanded to work with scripted events with a function throwevent() or so.
Script A:
PHP Code:
function doSomething() {
//stuff
throwevent(this.name, "DidSomething", params...);
}
Script B:
PHP Code:
function onCreated() {
this.catchevent("System", "DidSomething", "SystemDidSomething");
}
function onSystemDidSomething(params...) {
//stuff
}