UNPKG

rvx

Version:

A signal based rendering library

33 lines 831 B
import { $, batch } from "../core/signals.js"; import { normalize } from "./path.js"; import { Query } from "./query.js"; export class MemoryRouter { #path = $(undefined); #query = $(undefined); constructor(options) { this.#path.value = normalize(options?.path ?? ""); this.#query.value = Query.from(options?.query); } get root() { return this; } get parent() { return undefined; } get path() { return this.#path.value; } get query() { return this.#query.value; } push(path, query) { batch(() => { this.#path.value = normalize(path); this.#query.value = Query.from(query); }); } replace(path, query) { this.push(path, query); } } //# sourceMappingURL=memory-router.js.map