bablojs-test
Version:
A lightweight, fast, and scalable Single Page Application framework built with vanilla JavaScript. BABLOJS provides React-like features including Virtual DOM, hooks, routing, and component-based architecture without any build step or external dependencies
27 lines • 562 B
JavaScript
class Routes {
constructor(routes = {}) {
this.routes = routes;
}
route(route, component, meta = {}) {
this.routes[route] = {
component: component,
meta: meta,
};
}
all() {
return this.routes;
}
get(route) {
return this.routes[route];
}
has(route) {
return this.routes[route] !== undefined;
}
remove(route) {
delete this.routes[route];
}
clear() {
this.routes = {};
}
}
export default Routes;