From 22b1c6d56f16d51daaac1853c9fe58c061d44eaf Mon Sep 17 00:00:00 2001
From: Robert Long <robert@robertlong.me>
Date: Thu, 5 Apr 2018 17:01:12 -0700
Subject: [PATCH] Remove a-progressive-asset

---
 src/avatar-selector.js              |  1 -
 src/elements/a-progressive-asset.js | 67 -----------------------------
 src/hub.js                          |  2 -
 webpack.config.js                   |  9 +---
 4 files changed, 1 insertion(+), 78 deletions(-)
 delete mode 100644 src/elements/a-progressive-asset.js

diff --git a/src/avatar-selector.js b/src/avatar-selector.js
index ea3ff71a0..9f5aabab2 100644
--- a/src/avatar-selector.js
+++ b/src/avatar-selector.js
@@ -10,7 +10,6 @@ import "./vendor/GLTFLoader";
 import "./components/animation-mixer";
 import "./components/audio-feedback";
 import "./components/loop-animation";
-import "./elements/a-progressive-asset";
 import "./gltf-component-mappings";
 import { avatars } from "./assets/avatars/avatars";
 
diff --git a/src/elements/a-progressive-asset.js b/src/elements/a-progressive-asset.js
deleted file mode 100644
index db51b9b74..000000000
--- a/src/elements/a-progressive-asset.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Modified version of a-asset-item that adds high-src and low-src options
- * Extracted from https://github.com/aframevr/aframe/blob/master/src/core/a-assets.js
- */
-
-AFRAME.registerElement("a-progressive-asset", {
-  prototype: Object.create(AFRAME.ANode.prototype, {
-    createdCallback: {
-      value() {
-        this.data = null;
-        this.isAssetItem = true;
-      }
-    },
-
-    attachedCallback: {
-      value() {
-        if (!this.parentNode.fileLoader) {
-          throw new Error("a-progressive-asset must be the child of an a-assets element.");
-        }
-
-        this.fileLoader = this.parentNode.fileLoader;
-
-        const self = this;
-        const fallbackSrc = this.getAttribute("src");
-        const highSrc = this.getAttribute("high-src");
-        const lowSrc = this.getAttribute("low-src");
-
-        let src = fallbackSrc;
-
-        if (window.APP.quality === "high") {
-          src = highSrc;
-        } else if (window.APP.quality === "low") {
-          src = lowSrc;
-        }
-
-        this.fileLoader.setResponseType(this.getAttribute("response-type"));
-        this.fileLoader.load(
-          src,
-          function handleOnLoad(response) {
-            self.data = response;
-            /*
-            Workaround for a Chrome bug. If another XHR is sent to the same url before the
-            previous one closes, the second request never finishes.
-            setTimeout finishes the first request and lets the logic triggered by load open
-            subsequent requests.
-            setTimeout can be removed once the fix for the bug below ships:
-            https://bugs.chromium.org/p/chromium/issues/detail?id=633696&q=component%3ABlink%3ENetwork%3EXHR%20&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified
-          */
-            setTimeout(function load() {
-              AFRAME.ANode.prototype.load.call(self);
-            });
-          },
-          function handleOnProgress(xhr) {
-            self.emit("progress", {
-              loadedBytes: xhr.loaded,
-              totalBytes: xhr.total,
-              xhr: xhr
-            });
-          },
-          function handleOnError(xhr) {
-            self.emit("error", { xhr: xhr });
-          }
-        );
-      }
-    }
-  })
-});
diff --git a/src/hub.js b/src/hub.js
index 81bab1168..ed45825ea 100644
--- a/src/hub.js
+++ b/src/hub.js
@@ -66,8 +66,6 @@ if (qs.quality) {
   window.APP.quality = isMobile ? "low" : "high";
 }
 
-import "./elements/a-progressive-asset";
-
 import "aframe-physics-system";
 import "aframe-physics-extras";
 import "super-hands";
diff --git a/webpack.config.js b/webpack.config.js
index 44b833ced..56e643a72 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -118,14 +118,7 @@ const config = {
         loader: "html-loader",
         options: {
           // <a-asset-item>'s src property is overwritten with the correct transformed asset url.
-          attrs: [
-            "img:src",
-            "a-asset-item:src",
-            "a-progressive-asset:src",
-            "a-progressive-asset:high-src",
-            "a-progressive-asset:low-src",
-            "audio:src"
-          ],
+          attrs: ["img:src", "a-asset-item:src", "audio:src"],
           // You can get transformed asset urls in an html template using ${require("pathToFile.ext")}
           interpolate: "require"
         }
-- 
GitLab