src code

class EventEmitter

Description

A base class that implements the observer pattern commonly used throughout the Resources API classes, Game and Input, to name just a few.

If you are writing a custom class that fires "events", EventEmitter may be subclassed by calling the constructor function inside your class' constructor function, and inheriting EventEmitter's prototype via SGF.inherits:

var EventEmitter = SGF.require("EventEmitter");
 function MySubclass() {
    // Sets up instance properties
    EventEmitter.call(this);
}
// Make MySubclass.prototype inherit from EventEmitter.prototype
SGF.inherits(MySubclass, EventEmitter);