• Register a custom loader callback. For every file that is requested this callback is called with the url and mimetype. It should return a custom loader or null if it does not want to handle the file.

    Parameters

    • callback: CustomLoaderCallback

      The callback to register

    • Optionalopts: CustomLoaderOptions

      Optional options for the loader (e.g. name, priority)

    Returns () => void

    A function to unregister the callback

    import { onCreateModelLoader } from "@needle-tools/engine";
    const unregister = onCreateModelLoader((url, mimetype) => {
    if (mimetype === "application/vnd.usdz+zip") {
    return new CustomLoader();
    }
    return null;