@factor/app
Advanced tools
Comparing version 1.5.24 to 1.5.25
{ | ||
"name": "@factor/app", | ||
"version": "1.5.24", | ||
"version": "1.5.25", | ||
"license": "GPL-2.0", | ||
@@ -15,3 +15,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "28ef0237c1e238fa7b6f87b06ff4770aea5db163" | ||
"gitHead": "3fd3adaf05aa0bcb44c1716f26336b7fd6ad80b9" | ||
} |
@@ -167,2 +167,28 @@ import { applyFilters, runCallbacks, pushToFilter, addFilter } from "@factor/api/hooks" | ||
/** | ||
* Adds an array of routes to the router. | ||
* | ||
* @param _id A unique group identifier for the routes | ||
* @param routeItems Array of standard routes | ||
* @param options Optional route options | ||
* @category app | ||
*/ | ||
export const addContentRoutes = ({ | ||
key, | ||
routes, | ||
}: { | ||
key: string | ||
routes: RouteConfig[] | (() => RouteConfig[]) | ||
}): void => { | ||
addFilter({ | ||
hook: "content-routes", | ||
key, | ||
callback: (allRoutes: RouteConfig[]): RouteConfig[] => { | ||
const r = typeof routes === "function" ? routes() : routes | ||
return allRoutes.concat(r) | ||
}, | ||
}) | ||
} | ||
/** | ||
* Recurse through routes and child routes | ||
@@ -232,28 +258,2 @@ * Calling a callback for each route | ||
/** | ||
* Adds an array of routes to the router. | ||
* | ||
* @param _id A unique group identifier for the routes | ||
* @param routeItems Array of standard routes | ||
* @param options Optional route options | ||
* @category app | ||
*/ | ||
export const addContentRoutes = ({ | ||
key, | ||
routes, | ||
}: { | ||
key: string | ||
routes: RouteConfig[] | (() => RouteConfig[]) | ||
}): void => { | ||
addFilter({ | ||
hook: "content-routes", | ||
key, | ||
callback: (allRoutes: RouteConfig[]): RouteConfig[] => { | ||
const r = typeof routes === "function" ? routes() : routes | ||
return allRoutes.concat(r) | ||
}, | ||
}) | ||
} | ||
export const currentRoute = (): Route => { | ||
@@ -260,0 +260,0 @@ return getRouter().currentRoute |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package