in public/src/js/utils/sparklines.js [158:194]
function differential (collection) {
const front = collection.front;
const storyPackage = front.collection ? front.collection() : null;
const sparklines = storyPackage ? storyPackage.sparklines : null;
if (!sparklines || !sparklines.resolved) {
return;
}
const data = sparklines.data();
const newArticles = [];
collection.eachArticle(article => {
const webUrl = getWebUrl(article);
if (webUrl && !data[webUrl]) {
newArticles.push(webUrl);
}
});
if (newArticles.length) {
const storyPackageId = front.front();
sparklines.resolved = false;
sparklines.promise = getHistogram(newArticles)
.then(newData => {
if (storyPackageId === front.front()) {
_.each(newArticles, webUrl => {
data[webUrl] = newData[webUrl];
});
sparklines.data(data);
sparklines.resolved = true;
return data;
}
});
return front.sparklines.promise;
}
}