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

Check if options.localCache is undefined before continuing #32

Closed
softwarespot opened this issue Jul 15, 2015 · 2 comments
Closed

Check if options.localCache is undefined before continuing #32

softwarespot opened this issue Jul 15, 2015 · 2 comments

Comments

@softwarespot
Copy link
Contributor

If the user includes the function on each page, but doesn't require each ajax request to be 'cached', then more than likely they will not include localCache in the ajax options. Therefore a check for undefined should perhaps be done before anything else.

@SaneMethod
Copy link
Owner

This is handled by the checks against the options.localCache value, which determines what gets set in storage or value (depending on whether we're in the ajaxprefilter or the ajaxtransport function).

Since undefined logically evaluates as false (i.e. (!!undefined === false) === true), if localCache hasn't been included in the ajax options, the checks against the store or value in each function will ensure that the rest of the logic of either of these blocks won't be carried out, without the need for an additional explicit check for undefined.

@softwarespot
Copy link
Contributor Author

You're correct. I am just too explicit with these things I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants