addPlugins.js 598 B

123456789101112131415161718192021
  1. /*
  2. Copyright 2019 Google LLC
  3. Use of this source code is governed by an MIT-style
  4. license that can be found in the LICENSE file or at
  5. https://opensource.org/licenses/MIT.
  6. */
  7. import { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController.js';
  8. import './_version.js';
  9. /**
  10. * Adds plugins to the precaching strategy.
  11. *
  12. * @param {Array<Object>} plugins
  13. *
  14. * @memberof workbox-precaching
  15. */
  16. function addPlugins(plugins) {
  17. const precacheController = getOrCreatePrecacheController();
  18. precacheController.strategy.plugins.push(...plugins);
  19. }
  20. export { addPlugins };