Source
onEvent(String event, function) { if (this._handlers.keys.contains(event.toLowerCase())) { this._handlers[event].add(function); return this._handlers[event].indexOf(function); } else { throw new Exception("invalid event handler '$event'"); } }