« get me outta code hell

Move cache stuff to downloaders.js - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/index.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-05-29 09:59:01 -0300
committerFlorrie <towerofnix@gmail.com>2018-05-29 09:59:01 -0300
commit7c28e5c072ca27e6f2fc4a488c32718514aad924 (patch)
tree2af00ef680fd9bde46c7b9b8dc0ab9eb890d705a /index.js
parentb64a14b761a38da13b81370828a2d5e9ad68c330 (diff)
Move cache stuff to downloaders.js
Diffstat (limited to 'index.js')
-rw-r--r--index.js32
1 files changed, 2 insertions, 30 deletions
diff --git a/index.js b/index.js
index 6edbd01..a3b4b9f 100644
--- a/index.js
+++ b/index.js
@@ -5,36 +5,8 @@ const { getDownloaderFor } = require('./downloaders')
 const EventEmitter = require('events')
 
 class InternalApp extends EventEmitter {
-  constructor() {
-    super()
-
-    // downloadCache [downloaderFunction] [downloaderArg]
-    this.downloadCache = new Map()
-  }
-
-  async download(arg) {
-    const downloader = getDownloaderFor(arg)
-    if (this.downloadCache.has(downloader)) {
-      const category = this.downloadCache.get(downloader)
-      if (category.hasOwnProperty(arg)) {
-        return category[arg]
-      }
-    }
-
-    const ret = await this.downloadIgnoringCache(arg)
-
-    if (!this.downloadCache.has(downloader)) {
-      this.downloadCache.set(downloader, {})
-    }
-
-    this.downloadCache.get(downloader)[arg] = ret
-
-    return ret
-  }
-
-  downloadIgnoringCache(arg) {
-    const downloader = getDownloaderFor(arg)
-    return downloader(arg)
+  download(arg) {
+    return getDownloaderFor(arg)(arg)
   }
 }