katoikia-app/web-ui/web-react/node_modules/workbox-strategies/utils/messages.mjs

31 lines
781 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import {logger} from 'workbox-core/_private/logger.mjs';
import '../_version.mjs';
const getFriendlyURL = (url) => {
const urlObj = new URL(url, location);
if (urlObj.origin === location.origin) {
return urlObj.pathname;
}
return urlObj.href;
};
export const messages = {
strategyStart: (strategyName, request) => `Using ${strategyName} to ` +
`respond to '${getFriendlyURL(request.url)}'`,
printFinalResponse: (response) => {
if (response) {
logger.groupCollapsed(`View the final response here.`);
logger.log(response);
logger.groupEnd();
}
},
};