{"size": 506, "ext": "js", "max_stars_repo_path": "test/serviceWorkerLoader.js", "max_stars_repo_name": "mohsen1/service-worker-loader", "max_stars_repo_stars_event_min_datetime": "2017-07-16T18:49:07.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-12T12:26:15.000Z", "max_issues_repo_path": "test/serviceWorkerLoader.js", "max_issues_repo_name": "mohsen1/service-worker-loader", "max_issues_repo_issues_event_min_datetime": "2017-11-03T02:55:20.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-24T12:30:06.000Z", "max_forks_repo_path": "test/serviceWorkerLoader.js", "max_forks_repo_name": "mohsen1/service-worker-loader", "max_forks_repo_forks_event_min_datetime": "2017-10-23T17:52:46.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-05T22:29:19.000Z"}
{"max_stars_count": 18, "max_issues_count": 244, "max_forks_count": 10, "avg_line_length": 20.24, "max_line_length": 65, "alphanum_fraction": 0.6837944664}
/* eslint-env browser */
import registerServiceWorker, {
	ServiceWorkerNoSupportError,
	scriptUrl
} from './serviceWorker';

console.log('scriptUrl:', scriptUrl);

registerServiceWorker({ scope: '/' }).then(() => {

	console.log('Success!');

	navigator.serviceWorker.addEventListener('message', (event) => {
		console.log(event.data);
	});

}).catch((err) => {

	if (err instanceof ServiceWorkerNoSupportError) {
		console.log('ServiceWorker is not supported.');
	} else {
		console.log('Error!');
	}
});
