Let's do ES modules for browsers that support them
This commit is contained in:
parent
b19f8965e0
commit
4284c38e9c
@ -11,9 +11,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<?php if ($auth->isAuthenticated()): ?>
|
<?php if ($auth->isAuthenticated()): ?>
|
||||||
<script async="async" defer="defer" src="<?= $urlGenerator->assetUrl('js/scripts-authed.min.js') ?>"></script>
|
<script nomodule async="async" defer="defer" src="<?= $urlGenerator->assetUrl('js/scripts-authed.min.js') ?>"></script>
|
||||||
|
<script type="module" src="<?= $urlGenerator->assetUrl('js/src/index-authed.js') ?>"></script>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<script async="async" defer="defer" src="<?= $urlGenerator->assetUrl('js/scripts.min.js') ?>"></script>
|
<script nomodule async="async" defer="defer" src="<?= $urlGenerator->assetUrl('js/scripts.min.js') ?>"></script>
|
||||||
|
<script type="module" src="<?= $urlGenerator->assetUrl('js/src/index.js') ?>"></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,5 +1,5 @@
|
|||||||
import _ from './base/AnimeClient'
|
import _ from './base/AnimeClient.js'
|
||||||
import { renderAnimeSearchResults } from './template-helpers'
|
import { renderAnimeSearchResults } from './template-helpers.js'
|
||||||
|
|
||||||
const search = (query) => {
|
const search = (query) => {
|
||||||
// Show the loader
|
// Show the loader
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import _ from './AnimeClient';
|
import _ from './AnimeClient.js';
|
||||||
/**
|
/**
|
||||||
* Event handlers
|
* Event handlers
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import './index';
|
import './index.js';
|
||||||
|
|
||||||
import './anime';
|
import './anime.js';
|
||||||
import './manga';
|
import './manga.js';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import './base/events';
|
import './base/events.js';
|
||||||
|
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register('/sw.js').then(reg => {
|
navigator.serviceWorker.register('/sw.js').then(reg => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import _ from './base/AnimeClient'
|
import _ from './base/AnimeClient.js'
|
||||||
import { renderMangaSearchResults } from './template-helpers'
|
import { renderMangaSearchResults } from './template-helpers.js'
|
||||||
|
|
||||||
const search = (query) => {
|
const search = (query) => {
|
||||||
_.$('.cssload-loader')[ 0 ].removeAttribute('hidden');
|
_.$('.cssload-loader')[ 0 ].removeAttribute('hidden');
|
||||||
|
6
sw.js
6
sw.js
@ -21,7 +21,7 @@ async function update (request) {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh (response) {
|
/* function refresh (response) {
|
||||||
return self.clients.matchAll().then(clients => {
|
return self.clients.matchAll().then(clients => {
|
||||||
clients.forEach(client => {
|
clients.forEach(client => {
|
||||||
const message = {
|
const message = {
|
||||||
@ -33,7 +33,7 @@ function refresh (response) {
|
|||||||
client.postMessage(JSON.stringify(message));
|
client.postMessage(JSON.stringify(message));
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
} */
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
console.log('Public Folder Worker installed');
|
console.log('Public Folder Worker installed');
|
||||||
@ -70,6 +70,6 @@ self.addEventListener('fetch', event => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
update(event.request).then(refresh)
|
update(event.request)
|
||||||
);
|
);
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user