My project was originally in Angular, you can see it on GitHub still. But I'm trying to switch to Mithril.
I'm calling the request on the data.json file (served from GitHub Pages), which is just a list of events ordered by date (ordered at the time of compilation). The load time for the entire file is getting a little questionable, and it's only going to get worse.
My initial solution is to try to load a smaller initial subset of the data (via another file) and then load the rest, but I'm not sure how to do that with Mithril. (Additionally I'll eventually need to do some computation on the data before it's output, if that has any relevance. Like adding attributes to mark year and month boundaries.)
The current relevant code is just this.eventlist = m.request({method: "GET", url: "data.json"});
sitting in the controller. Any suggestions on how I might do this in Mithril (or any suggestion for a better idea) would be appreciated.
Here is the code I have so far:
"use strict",
(function(){
var app = {};
app.controller = function() {
this.eventlist = m.request({method: "GET", url: "data.json"});
};
app.view = function(controller) {
return m("ul", [
controller.eventlist().map(function(item){
console.log(item);
return m("li", [
m("a", {href: item.url}, item.name),
m("div", item.description)
]);
})
]);
};
m.module(document.body, app);
})();