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

Make FetchListenerOptions optional #2118

Merged
merged 1 commit into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions packages/workbox-precaching/src/addRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let listenerAdded = false;
* responded to, allowing the event to fall through to other `fetch` event
* listeners.
*
* @param {Object} options
* @param {Object} [options]
* @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
* check cache entries for a URLs ending with '/' to see if there is a hit when
* appending the `directoryIndex` value.
Expand All @@ -32,11 +32,11 @@ let listenerAdded = false;
* check the cache for the URL with a `.html` added to the end of the end.
* @param {workbox.precaching~urlManipulation} [options.urlManipulation]
* This is a function that should take a URL and return an array of
* alternative URL's that should be checked for precache matches.
* alternative URLs that should be checked for precache matches.
*
* @alias workbox.precaching.addRoute
*/
export const addRoute = (options: FetchListenerOptions) => {
export const addRoute = (options?: FetchListenerOptions) => {
if (!listenerAdded) {
addFetchListener(options);
listenerAdded = true;
Expand Down
4 changes: 2 additions & 2 deletions packages/workbox-precaching/src/precacheAndRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import './_version.js';
* [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.
*
* @param {Array<Object|string>} entries Array of entries to precache.
* @param {Object} options See
* @param {Object} [options] See
* [addRoute() options]{@link module:workbox-precaching.addRoute}.
*
* @alias workbox.precaching.precacheAndRoute
*/
export const precacheAndRoute =
(entries: Array<PrecacheEntry|string>, options: FetchListenerOptions) => {
(entries: Array<PrecacheEntry|string>, options?: FetchListenerOptions) => {
precache(entries);
addRoute(options);
};
4 changes: 2 additions & 2 deletions packages/workbox-precaching/src/utils/addFetchListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface FetchListenerOptions {
* of tests.
*
* @private
* @param {Object} options
* @param {Object} [options]
* @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
* check cache entries for a URLs ending with '/' to see if there is a hit when
* appending the `directoryIndex` value.
Expand All @@ -46,7 +46,7 @@ export interface FetchListenerOptions {
* check the cache for the URL with a `.html` added to the end of the end.
* @param {workbox.precaching~urlManipulation} [options.urlManipulation]
* This is a function that should take a URL and return an array of
* alternative URL's that should be checked for precache matches.
* alternative URLs that should be checked for precache matches.
*/
export const addFetchListener = ({
ignoreURLParametersMatching = [/^utm_/],
Expand Down