1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update shared components

This commit is contained in:
Luke Pulverenti 2016-08-28 14:59:14 -04:00
parent f2e02b7c2d
commit feb3d5ae05
12 changed files with 76 additions and 110 deletions

View file

@ -7,8 +7,6 @@ var staticFileBaseUrl = baseUrl + '/staticfiles';
console.log('service worker location: ' + self.location);
console.log('service worker base url: ' + baseUrl);
var connectionManager;
function getStaticFileList() {
if (staticFileList) {
@ -101,54 +99,4 @@ self.addEventListener('activate', function (event) {
);
});
function getApiClient(serverId) {
if (connectionManager) {
return Promise.resolve(connectionManager.getApiClient(serverId));
}
//importScripts('serviceworker-cache-polyfill.js');
return Promise.reject();
}
function executeAction(action, data, serverId) {
return getApiClient(serverId).then(function (apiClient) {
switch (action) {
case 'cancel-install':
var id = data.id;
return apiClient.cancelPackageInstallation(id);
case 'restart':
return apiClient.restartServer();
default:
clients.openWindow("/");
return Promise.resolve();
}
});
}
self.addEventListener('notificationclick', function (event) {
var notification = event.notification;
notification.close();
var data = notification.data;
var serverId = data.serverId;
var action = event.action;
if (!action) {
clients.openWindow("/");
event.waitUntil(Promise.resolve());
return;
}
event.waitUntil(executeAction(action, data, serverId));
}, false);
self.addEventListener('sync', function (event) {
if (event.tag == 'emby-sync') {
}
});
importScripts("bower_components/emby-webcomponents/serviceworker/notifications.js", "bower_components/emby-webcomponents/serviceworker/sync.js");