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

Add cacheBuster option #336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

zhouzi
Copy link

@zhouzi zhouzi commented Aug 3, 2016

This PRs moves the cacheBuster function to a configurable option. That way you can manage how the urls are generated and thus the cache invalidated, e.g:

angular
  .module('app', [
    'oc.lazyLoad',
  ])
  .config([
    '$ocLazyLoadProvider',
    function ($ocLazyLoadProvider) {
      $ocLazyLoadProvider.config({
        cacheBuster: function (url) {
          // this is just an example and will not work for urls
          // that already have query parameters
          return url + '?_cache=' + window.assetsVersion;
        }
      });
    }
  ]);

Related to #306

Note: the cacheBuster is used only when the cache option is set to false, which is a per file option. If you want to set cache to false for every modules, have at look at #335

@zhouzi
Copy link
Author

zhouzi commented Aug 3, 2016

Historically, some loaders weren't using the cacheBuster so I am adding them one by one as I'm needing them. Let me know if I've missed one that's useful to you.

@luismatesanz
Copy link

When change is merge with master branch?
I really need it.

@zhouzi
Copy link
Author

zhouzi commented Aug 31, 2016

@luismatesanz I am afraid this PR is not going to be merged any time soon. If you really need it, you can install this fork via: npm install wizbii/ocLazyLoad#merge

@ronaldohoch
Copy link

Up! :D

We need it.

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

Successfully merging this pull request may close these issues.

None yet

3 participants