Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support $('#main').data('smoothState').reload() #363

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/jquery.smoothState.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,30 @@
window.location = url;
}
},
/**Reload the page */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs a docblock like all the others, just to keep to coding standards.

reload = function () {
// Apply rate limiting.
if (!isRateLimited()) {

// Set the delay timeout until the next event is allowed.
setRateLimitRepeatTime();

// clear cache
cache = {};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if someone's cache has 4 or 5 entries, will this wipe the entire thing? Possible to search for the current location and remove only the one entry?

$container.data('smoothState').cache = cache;

var request = utility.translate(window.location.href);
isTransitioning = true;
targetHash = window.location.hash;

// Allows modifications to the request
request = options.alterRequest(request);
console.log(request);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this console.log just a leftover debug or intentional?

options.onBefore(null, $container);

load(request);
}
},
/**
* Loads the contents of a url into our container
* @param {string} url
Expand Down Expand Up @@ -799,6 +822,7 @@
href: currentHref,
cache: cache,
clear: clear,
reload: reload,
load: load,
fetch: fetch,
restartCSSAnimations: restartCSSAnimations
Expand Down