import window_default from "../window.js";
function dispatchEvent(t, n, r) {
	var i = window_default(t), a = i.CustomEvent;
	typeof a == "function" ? a = new a(n, r) : (a = i.document.createEvent("Event"), r ? (a.initEvent(n, r.bubbles, r.cancelable), a.detail = r.detail) : a.initEvent(n, !1, !1)), t.dispatchEvent(a);
}
function dispatchConstant(e, n) {
	return function() {
		return dispatchEvent(this, e, n);
	};
}
function dispatchFunction(e, n) {
	return function() {
		return dispatchEvent(this, e, n.apply(this, arguments));
	};
}
function dispatch_default(e, t) {
	return this.each((typeof t == "function" ? dispatchFunction : dispatchConstant)(e, t));
}
export { dispatch_default as default };
