1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 23:44:27 +02:00

Roughly implement routes and data preloading

Only preloading data for basic requests w/o query params, at least for
the moment - if we have to preload for something like
/?q=test&sort=newest, we end up having to duplicate a whole lot of
logic between JS/PHP.
This commit is contained in:
Toby Zerner
2015-06-18 17:41:37 +09:30
parent c2da4a946f
commit 822a216cc9
11 changed files with 126 additions and 26 deletions

View File

@@ -18,8 +18,11 @@ export default function(app) {
app.history = new History();
app.pane = new Pane(id('page'));
app.search = new SearchBox();
app.cache = {};
m.startComputation();
m.mount(id('back-control'), BackButton.component({ className: 'back-control', drawer: true }));
m.mount(id('back-button'), BackButton.component());
@@ -39,10 +42,12 @@ export default function(app) {
app.modal = m.mount(id('modal'), Modal.component());
app.alerts = m.mount(id('alerts'), Alerts.component());
m.route.mode = 'hash';
m.route.mode = 'pathname';
m.route(id('content'), '/', mapRoutes(app.routes));
app.search = new SearchBox();
m.endComputation();
new ScrollListener(top => $('body').toggleClass('scrolled', top > 0)).start();
app.booted = true;
}