gallery.accords-library.com/client/js/controllers/page_controller.js

36 lines
808 B
JavaScript
Raw Normal View History

2016-04-10 20:13:01 +00:00
'use strict';
2016-04-12 21:49:46 +00:00
const events = require('../events.js');
const settings = require('../settings.js');
2016-04-12 21:49:46 +00:00
const EndlessPageView = require('../views/endless_page_view.js');
2016-04-10 20:13:01 +00:00
const ManualPageView = require('../views/manual_page_view.js');
class PageController {
constructor() {
2016-04-12 21:49:46 +00:00
events.listen(events.SettingsChange, () => {
this.update();
return true;
2016-04-12 21:49:46 +00:00
});
this.update();
}
update() {
if (settings.getSettings().endlessScroll) {
2016-04-12 21:49:46 +00:00
this.pageView = new EndlessPageView();
} else {
this.pageView = new ManualPageView();
}
2016-04-10 20:13:01 +00:00
}
run(ctx) {
this.pageView.unrender();
2016-04-10 20:13:01 +00:00
this.pageView.render(ctx);
}
2016-04-12 21:49:46 +00:00
stop() {
this.pageView.unrender();
}
2016-04-10 20:13:01 +00:00
}
module.exports = new PageController();