node-web-mvc
Version:
node spring mvc
29 lines (28 loc) • 939 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const InterceptorRegistration_1 = __importDefault(require("./InterceptorRegistration"));
class HandlerInteceptorRegistry {
constructor() {
this.registrations = [];
}
/**
* 获取当前注册的所有拦截器
*/
getInterceptors() {
return this.registrations
.sort((o1, o2) => o1.getOrder() - o2.getOrder())
.map((registration) => registration.getInterceptor());
}
/**
* 添加一个拦截器
*/
addInterceptor(interceptor) {
const registration = new InterceptorRegistration_1.default(interceptor);
this.registrations.push(registration);
return registration;
}
}
exports.default = HandlerInteceptorRegistry;