Repository: google/filament
File: docs/viewer/filament-viewer.js (JavaScript)

Code before:
        }

        // Dropping a glb file is simple because there are no external resources.
        if (this.srcBlob && this.srcBlob.name.endsWith(".glb")) {
            this.srcBlob.arrayBuffer().then(buffer => {
                this.asset = this.loader.createAsset(new Uint8Array(buffer));
                const aabb = this.asset.getBoundingBox();
                this.assetRoot = this.asset.getRoot();
                this.unitCubeTransform = Filament.fitIntoUnitCube(aabb, zoffset);
                this.asset.loadResources();
                this.animator = this.asset.getInstance().getAnimator();
                this.animationStartTime = Date.now();
                this._updateOverlay();
            });
            return;
        }

        // Dropping a fileset requires pushing each resource to ResourceLoader.
        if (this.srcBlob && this.srcBlob.name.endsWith(".gltf")) {

            const config = {
                normalizeSkinningWeights: true,
                asyncInterval: 30
            };

            const doneAddingResources = (resourceLoader, stbProvider, ktx2Provider, webpProvider) => {
                this.srcBlobResources = {};
                resourceLoader.asyncBeginLoad(this.asset);
                const timer = setInterval(() => {
                    resourceLoader.asyncUpdateLoad();
                    const progress = resourceLoader.asyncGetLoadProgress();
                    if (progress >= 1) {
                        clearInterval(timer);
                        resourceLoader.delete();
                        stbProvider.delete();
                        ktx2Provider.delete();
                        webpProvider.delete();
                        this.animator = this.asset.getInstance().getAnimator();
                        this.animationStartTime = Date.now();
                    }
                }, config.asyncInterval);
            };

            this.srcBlob.arrayBuffer().then(buffer => {
                this.asset = this.loader.createAsset(new Uint8Array(buffer));
                const aabb = this.asset.getBoundingBox();
                this.assetRoot = this.asset.getRoot();
                this.unitCubeTransform = Filament.fitIntoUnitCube(aabb, zoffset);

                const resourceLoader = new Filament.gltfio$ResourceLoader(this.engine,
                    config.normalizeSkinningWeights);

Review comment (suggestion):
please don't change this file since this whole directory is auto updated.  
Changes should go to `docs_src/src_raw/viewer/filament-viewer.js`


Code after:
        }

        // Dropping a glb file is simple because there are no external resources.
        if (this.srcBlob && this.srcBlob.name.endsWith(".glb")) {
            this.srcBlob.arrayBuffer().then(buffer => {
                this.asset = this.loader.createAsset(new Uint8Array(buffer));
                const aabb = this.asset.getBoundingBox();
                this.assetRoot = this.asset.getRoot();
                this.unitCubeTransform = Filament.fitIntoUnitCube(aabb, zoffset);
                this.asset.loadResources();
                this.animator = this.asset.getInstance().getAnimator();
                this.animationStartTime = Date.now();
                this._updateOverlay();
            });
            return;
        }

        // Dropping a fileset requires pushing each resource to ResourceLoader.
        if (this.srcBlob && this.srcBlob.name.endsWith(".gltf")) {

            const config = {
                normalizeSkinningWeights: true,
                asyncInterval: 30
            };

            const doneAddingResources = (resourceLoader, stbProvider, ktx2Provider) => {
                this.srcBlobResources = {};
                resourceLoader.asyncBeginLoad(this.asset);
                const timer = setInterval(() => {
                    resourceLoader.asyncUpdateLoad();
                    const progress = resourceLoader.asyncGetLoadProgress();
                    if (progress >= 1) {
                        clearInterval(timer);
                        resourceLoader.delete();
                        stbProvider.delete();
                        ktx2Provider.delete();
                        this.animator = this.asset.getInstance().getAnimator();
                        this.animationStartTime = Date.now();
                    }
                }, config.asyncInterval);
            };

            this.srcBlob.arrayBuffer().then(buffer => {
                this.asset = this.loader.createAsset(new Uint8Array(buffer));
                const aabb = this.asset.getBoundingBox();
                this.assetRoot = this.asset.getRoot();
                this.unitCubeTransform = Filament.fitIntoUnitCube(aabb, zoffset);

                const resourceLoader = new Filament.gltfio$ResourceLoader(this.engine,
                    config.normalizeSkinningWeights);