I can’t get this to work. Am I using the Observable add-function wrong? I want to add X news when the scroll reaches the end, but it seems like it is not.
JavaScript:
<JavaScript>
var Observable = require("FuseJS/Observable");
var data = new Observable();
var skip = 0;
function addNews() {
fetch('https://example.com/api/news/' + 5 + '/' + skip)
.then(function(response) { return response.json(); })
.then(function(responseObject) { data.add(responseObject); });
skip = skip + 5;
}
addNews();
module.exports = {
data: data,
addNews: addNews
};
</JavaScript>
But all this is highly speculative, since there is zero visibility on what the data structures you are working with look like. And you clearly should go and spend some time on this page on Observables.
But all this is highly speculative, since there is zero visibility on what the data structures you are working with look like. And you clearly should go and spend some time on this page on Observables.