zent
Version:
一套前端设计语言和基于React的实现
29 lines (28 loc) • 1.05 kB
JavaScript
var QueryHandler = (function () {
function QueryHandler(options) {
this.options = options;
!options.deferSetup && this.setup();
}
QueryHandler.prototype.setup = function () {
var _a, _b;
(_b = (_a = this.options).setup) === null || _b === void 0 ? void 0 : _b.call(_a);
this.initialized = true;
};
QueryHandler.prototype.on = function () {
var _a, _b;
!this.initialized && this.setup();
(_b = (_a = this.options).match) === null || _b === void 0 ? void 0 : _b.call(_a);
};
QueryHandler.prototype.off = function () {
var _a, _b;
(_b = (_a = this.options).unmatch) === null || _b === void 0 ? void 0 : _b.call(_a);
};
QueryHandler.prototype.destroy = function () {
this.options.destroy ? this.options.destroy() : this.off();
};
QueryHandler.prototype.equals = function (target) {
return this.options === target || this.options.match === target;
};
return QueryHandler;
}());
export { QueryHandler };