Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (cachedModel) {
// 2. If cachedModel, get future_timestamp (ms since 1970) and compare to now
let future_timestamp = Object.keys(cachedModel)[0];
if (future_timestamp > Date.now()) {
return cachedModel[future_timestamp];
} else {
// 3. cache collection based on new timestamp
cacheInfinityCollection(_cachedCollection, infinityModel, uniqueIdentifier, infinityCache);
}
} else {
// 2. if we are expired (future_timestamp < Date.now()) or cachedModel doesn't exist, cache a new infinityModel + future timestamp
cacheInfinityCollection(_cachedCollection, infinityModel, uniqueIdentifier, infinityCache);
}
}
return InfinityPromiseArray.create({ promise: this['loadNextPage'](infinityModel) });
}
if (didPassBoundParams) {
initParams._deprecatedBoundParams = boundParams;
initParams.route = this;
}
if (infinityModelLoaded) {
initParams.infinityModelLoaded = infinityModelLoaded;
}
if (afterInfinityModel) {
initParams.afterInfinityModel = afterInfinityModel;
}
const infinityModel = InfinityModelFactory.create(initParams);
get(this, 'infinity._ensureCompatibility')(get(infinityModel, 'store'), get(infinityModel, 'storeFindMethod'));
get(this, 'infinity.infinityModels').pushObject(infinityModel);
return InfinityPromiseArray.create({ promise: service['loadNextPage'](infinityModel) });
},