@tanstack/solid-router
Version:
Modern and scalable routing for Solid applications
31 lines (30 loc) • 928 B
JavaScript
import { noteRequest, releaseRequest } from "./observe.js";
import { getStoreFactory } from "./routerStores.js";
import { primeRouterFromRegistry } from "./registryTransfer.js";
import { RouterCore } from "@tanstack/router-core";
import * as Solid from "solid-js";
import { isServer } from "@tanstack/router-core/isServer";
//#region src/router.ts
var createRouter = (options) => {
return new Router(options);
};
var Router = class extends RouterCore {
constructor(options) {
super(options, getStoreFactory);
if (!(isServer ?? this.isServer)) {
primeRouterFromRegistry(this);
if (Solid.OBSERVE !== void 0) {
const commitLocation = this.commitLocation;
this.commitLocation = (opts) => {
noteRequest(this);
const committed = commitLocation(opts);
releaseRequest(this);
return committed;
};
}
}
}
};
//#endregion
export { Router, createRouter };
//# sourceMappingURL=router.js.map