0 days since new JS framework. https://t.co/YHGMOWJa9q— Jesse Warden (@jesterxl) August 11, 2016
I began by looking at the GitHub API for searching repositories. It seemed perfect. We can:
- Include a text filter for "framework" (obviously not perfect but what evs)
And then obviously just sort and find the most recent one. Unfortunately, this is where things break down. You can't sort by a project's created date, just its updated date (and a few other fields).
I did some more digging, and discovered you could filter by the date a project was created. I then figured out you could use pseudo-code like this:
Repeat 10 times and subtract one from the current date. When you find a match, you know the number of days.
Why 10? You can only do 10 anonymous API calls to GitHub per day. Plus, does anyone honestly think it will be more than 10 days since the last JS framework? Technically, we could 'step' back by two day increments letting us check a longer time period. We could also simply tell the user that they have to wait 60 seconds and then do 10 more hits. But for now - I just assumed there would always be a match in a ten day period.
Here's the code (it integrates with the DOM too but I assume folks don't need to see that):
Want to see it? Check the demo (and my amazing CSS skills) here: https://static.raymondcamden.com/demos/2016/08/11/index.html