UNPKG

@mojojs/core

Version:

Real-time web framework

30 lines 746 B
/** * Router plan class. */ export class Plan { constructor() { /** * Route endpoint. */ this.endpoint = undefined; /** * Steps in route. */ this.steps = []; /** * Dispatch stops in route. */ this.stops = []; } /** * Render route. */ render(values = {}) { const merged = [...this.steps, values].reduce((result, current) => Object.assign(result, current), {}); const { endpoint } = this; if (endpoint === undefined) return { path: '', websocket: false }; return { path: endpoint.render(merged), websocket: endpoint.hasWebSocket() }; } } //# sourceMappingURL=plan.js.map