mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 07:09:57 +08:00
Replace Ember app with Mithril app
This commit is contained in:
21
js/lib/utils/app.js
Normal file
21
js/lib/utils/app.js
Normal file
@ -0,0 +1,21 @@
|
||||
import ItemList from 'flarum/utils/item-list';
|
||||
|
||||
class App {
|
||||
constructor() {
|
||||
this.initializers = new ItemList();
|
||||
this.cache = {};
|
||||
}
|
||||
|
||||
boot() {
|
||||
this.initializers.toArray().forEach((initializer) => initializer(this));
|
||||
}
|
||||
|
||||
route(name, args, queryParams) {
|
||||
var queryString = m.route.buildQueryString(queryParams);
|
||||
return this.routes[name][0].replace(/:([^\/]+)/g, function(m, t) {
|
||||
return typeof args[t] === 'function' ? args[t]() : args[t];
|
||||
}) + (queryString ? '?'+queryString : '');
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
Reference in New Issue
Block a user