"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class NavService {
    static async go(routeName, additionalProps = null) {
        if (this.handlers_.length) {
            const r = await this.handlers_[this.handlers_.length - 1]();
            if (r)
                return r;
        }
        this.dispatch(Object.assign({ type: 'NAV_GO', routeName: routeName }, additionalProps));
        return false;
    }
    // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
    static addHandler(handler) {
        for (let i = this.handlers_.length - 1; i >= 0; i--) {
            const h = this.handlers_[i];
            if (h === handler)
                return;
        }
        this.handlers_.push(handler);
    }
    // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
    static removeHandler(handler) {
        for (let i = this.handlers_.length - 1; i >= 0; i--) {
            const h = this.handlers_[i];
            if (h === handler)
                this.handlers_.splice(i, 1);
        }
    }
}
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
NavService.dispatch = () => { };
NavService.handlers_ = [];
exports.default = NavService;
//# sourceMappingURL=NavService.js.map