import { get, init, set } from "./schedule.js";
function start(e) {
	return (e + "").trim().split(/^|\s+/).every(function(e) {
		var t = e.indexOf(".");
		return t >= 0 && (e = e.slice(0, t)), !e || e === "start";
	});
}
function onFunction(e, i, a) {
	var o, s, c = start(i) ? init : set;
	return function() {
		var t = c(this, e), n = t.on;
		n !== o && (s = (o = n).copy()).on(i, a), t.on = s;
	};
}
function on_default(t, n) {
	var r = this._id;
	return arguments.length < 2 ? get(this.node(), r).on.on(t) : this.each(onFunction(r, t, n));
}
export { on_default as default };
