Skip to content

Commit

Permalink
Speed up PV display.
Browse files Browse the repository at this point in the history
  • Loading branch information
cotes2020 committed May 11, 2020
1 parent 32100a4 commit a280981
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion assets/js/_src/pageviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ $(function() {

if ($('.pageviews').length > 0) {

let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
let cache = PvCache.getData();

if (cache) {
if (PvCache.isExpired()) {
if (PvCache.isProxyCache() ) {
let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
if (originPvData) {
if (PvCache.newerThan(originPvData)) {
displayPageviews(cache);
Expand All @@ -215,6 +215,7 @@ $(function() {
}

} else {
let originPvData = pageviews ? JSON.parse(pageviews) : undefined;
fetchOriginPageviews(originPvData);
fetchProxyPageviews();
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dist/pageviews.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a280981

Please sign in to comment.