react-antd-admin-panel
Version:
Easy prototyping admin panel using React and Antd
42 lines • 1.24 kB
JavaScript
import Cycle from "../models/Cycle";
export default class Controller {
constructor(app) {
this._cycles = {};
this.main = app;
}
onCycle(route, next, failed) {
let cycle = this.registerCycle(new Cycle(this.main, route, next, failed));
this.main.$store(cycle, 'cycle');
cycle.handle();
}
onCycleFailed(cycle) {
this.main.$map.$loading(false);
if (cycle._failed) {
cycle._failed();
}
else {
this.main.$config.config.access.accessViolationRoute(this.main, cycle);
}
}
onCycleComplete(cycle) {
setTimeout(() => {
cycle._next();
this.main.$map.$loading(false);
this.main.$store(cycle._path, 'path');
}, 100);
}
isDebug() {
var _a;
return (_a = this.main.$config.config) === null || _a === void 0 ? void 0 : _a.debugLevel;
}
registerCycle(cycle) {
if (this._cycles[cycle._key]) {
this._cycles[cycle._key].push(cycle);
}
else {
this._cycles[cycle._key] = [cycle];
}
return cycle;
}
}
//# sourceMappingURL=Controller.js.map