framework/js/lib/utils/app.js

25 lines
552 B
JavaScript
Raw Normal View History

2015-04-25 20:58:39 +08:00
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, params) {
var url = this.routes[name][0].replace(/:([^\/]+)/g, function(m, t) {
var value = params[t];
delete params[t];
return value;
});
var queryString = m.route.buildQueryString(params);
return url+(queryString ? '?'+queryString : '');
2015-04-25 20:58:39 +08:00
}
}
export default App;