Created
November 20, 2018 20:21
-
-
Save ghsyeung/88fb0d713b406a536df05ec576bc3113 to your computer and use it in GitHub Desktop.
Dependency Injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from "fetch"; | |
class WebScraper { | |
public download(link) { | |
const page = fetch(link); | |
if (page.status === "OK") { | |
this.cache.add(link, page); | |
} else { | |
this.scheduler.schedule(link); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment