ReeceM/h-bar

Allow Loading of predefined JSON (static) objects

ReeceM opened this issue · 0 comments

When using this on another platform, the data might be already there from other sources (my situation). Rather than make another API call to url, I propose having another parameter, eg announcements, which would have the content as returned by the API, eg

announcements: [
{
"url": "https://api.github.com/repos/ReeceM/h-bar/releases/27306040",
"assets_url": "https://api.github.com/repos/ReeceM/h-bar/releases/27306040/assets",
"upload_url": "[https://uploads.github.com/repos/ReeceM/h-bar/releases/27306040/assets{?name,label}](https://uploads.github.com/repos/ReeceM/h-bar/releases/27306040/assets%7B?name,label})",
"html_url": "https://github.com/ReeceM/h-bar/releases/tag/2.0.0-rc1",
"id": 27306040,
"author": {
...

One could set either announcements or url in the init() call. If announcements is set, just skip fetching content from URL and proceed with next step, probably parser.

This extents the usability of this library to many other cases, rather than being forced to load content from an URL.

Originally posted by @mariusa in #28 (comment)