All files / tao-routing-react-router/src import-loader.js

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                                    2x    
import { createImportLoader } from '@tao.js/routing-core';
 
/** @typedef {import('@tao.js/core').Kernel} Kernel */
/** @typedef {import('@tao.js/routing-core').ImportLoaderOptions} ImportLoaderOptions */
/** @typedef {import('@tao.js/routing-core').ImportLoader} ImportLoader */
 
/**
 * React Router-oriented alias of `createImportLoader`.
 * Use the returned function as a route `loader` helper: it dynamic-imports
 * a TAO feature module, initializes it against the Kernel, and resolves
 * with the `{ signal }` bag `useLoaderSignal` reads back via
 * `useLoaderData`.
 *
 * @param {Kernel} TAO
 * @param {ImportLoaderOptions} [options]
 * @returns {ImportLoader}
 */
export function importLoader(TAO, options) {
  return createImportLoader(TAO, options);
}