<commit_before>import Disposable from 'seng-disposable';
import IEventDispatcher from "./IEventDispatcher";
import IEvent from "./IEvent";
import EventListenerData from "./EventListenerData";
import EventPhase from "./EventPhase";
import CallListenerResult from "./CallListenerResult";

export default class EventDispatcher extends Disposable implements IEventDispatcher
{
	public parent:EventDispatcher;
	private _listeners:EventListenerMap = {};
	private _target:IEventDispatcher;

	constructor(target?:IEventDispatcher, parent:EventDispatcher = null)
	{
		super();

		this._target = target || this;
		this.parent = parent;
	}

	public dispatchEvent(event:IEvent):boolean
	{
		if (this.isDisposed())
		{
			// todo: _log.error("Can't dispatchEvent on a disposed EventDispatcher");
		}
		else
		{
			// todo: on debug builds, check willTrigger and log if false

			const callTree = getCallTree(this, event.bubbles);
			event.target = this._target;
			event.eventPhase = callTree.length === 1 ? EventPhase.AT_TARGET : EventPhase.CAPTURING_PHASE;

			for (let i = 0; i < callTree.length; i++)
			{
				const currentTarget = callTree[i];<commit_msg>Swap arguments for EventDispatcher constructor<commit_after>import Disposable from 'seng-disposable';
import IEventDispatcher from "./IEventDispatcher";
import IEvent from "./IEvent";
import EventListenerData from "./EventListenerData";
import EventPhase from "./EventPhase";
import CallListenerResult from "./CallListenerResult";

export default class EventDispatcher extends Disposable implements IEventDispatcher
{
	public parent:EventDispatcher;
	private _listeners:EventListenerMap = {};
	private _target:IEventDispatcher;

	constructor(parent:EventDispatcher = null, target?:IEventDispatcher)
	{
		super();

		this._target = target || this;
		this.parent = parent;
	}

	public dispatchEvent(event:IEvent):boolean
	{
		if (this.isDisposed())
		{
			// todo: _log.error("Can't dispatchEvent on a disposed EventDispatcher");
		}
		else
		{
			// todo: on debug builds, check willTrigger and log if false

			const callTree = getCallTree(this, event.bubbles);
			event.target = this._target;
			event.eventPhase = callTree.length === 1 ? EventPhase.AT_TARGET : EventPhase.CAPTURING_PHASE;

			for (let i = 0; i < callTree.length; i++)
			{
				const currentTarget = callTree[i];
{'fraction_non_alphanumeric': 0.1065749892565535, 'fraction_numerical': 0.0017189514396218307, 'mean_word_length': 4.8639798488664985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4481986', 'n_tokens_mistral': 748, 'n_tokens_neox': 654, 'n_words': 183}