jnsmalm / pixi3d

The 3D renderer for PixiJS. Seamless integration with 2D applications.
https://pixi3d.org
MIT License
759 stars 44 forks source link

feat: add options to fromURL #140

Closed cqh963852 closed 1 year ago

cqh963852 commented 1 year ago

relate https://github.com/jnsmalm/pixi3d/issues/139

jnsmalm commented 1 year ago

Could you please just give quick example how to cancel the request with this setup?

cqh963852 commented 1 year ago
import * as PIXI3D from "pixi3d/pixi7";

const controller = new AbortController();

const handler = setTimeout(() => {
  controller.abort();
}, 10000);

PIXI3D.glTFAsset
  .fromURL(
    "https://raw.githubusercontent.com/jnsmalm/pixi3d-sandbox/master/assets/teapot/teapot.gltf",
    {
      controller,
    }
  )
  .then(() => {
    clearTimeout(handler);
  });
jnsmalm commented 1 year ago

Thanks for helping!