반응형
'자체' 무제한 글로벌 반응의 예기치 않은 사용
PWA 앱의 서비스 워커를 작성하려고 하면 이 에러가 발생합니다.구글/모질라 샘플을 서비스직 직원용으로 사용했습니다만, 어쨌든.
var CACHE_NAME = 'test-cache';
var urlsToCache = [
'/'
];
self.addEventListener('install', function (event) {
event.waitUntil(
caches.open(CACHE_NAME)
.then(function (cache) {
console.log('Opened cache');
return cache.addAll(urlsToCache);
})
);
});
명시적으로 삭제할 수 있습니다.selfno-disabled-timeouts-rule 또는 단순히 다음 행에 대한 규칙을 디세블로 합니다.self사용.eslint-disable-line또는eslint-disable-next-line:
self.addEventListener('install', function (event) { /* eslint-disable-line no-restricted-globals */
...
또는
/* eslint-disable-next-line no-restricted-globals */
self.addEventListener('install', function (event) {
...
사용하다window.self대신self.
더하다var self = this;또는 사용this.addEventListener(...)
언급URL : https://stackoverflow.com/questions/44292520/unexpected-use-of-self-no-restricted-globals-react
반응형
'programing' 카테고리의 다른 글
| get_press() orderby name이 작동하지 않습니다.word press (0) | 2023.02.27 |
|---|---|
| pymongo에서 show dbs를 발행하는 방법 (0) | 2023.02.27 |
| 스크립트를 비동기적으로 로드하다 (0) | 2023.02.27 |
| React.js에서 메타 태그를 업데이트하려면 어떻게 해야 합니까? (0) | 2023.02.27 |
| 유형 'null'은 유형 'T'에 할당할 수 없습니다. (0) | 2023.02.27 |