2024-05-11 10:51:20 +00:00
|
|
|
import * as plugins from './plugins.js';
|
2024-05-24 23:24:02 +00:00
|
|
|
import { ServiceWorker } from './classes.serviceworker.js';
|
2024-05-11 10:51:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Taskmanager
|
|
|
|
* should use times allocated by browser
|
|
|
|
*/
|
|
|
|
export class TaskManager {
|
2024-05-23 13:28:41 +00:00
|
|
|
public serviceworkerRef: ServiceWorker;
|
2024-08-27 09:22:13 +00:00
|
|
|
public taskmanager = new plugins.taskbuffer.TaskManager();
|
2024-05-11 10:51:20 +00:00
|
|
|
|
2024-05-23 13:28:41 +00:00
|
|
|
constructor(serviceWorkerRefArg: ServiceWorker) {
|
2024-05-11 10:51:20 +00:00
|
|
|
this.serviceworkerRef = serviceWorkerRefArg;
|
2024-08-27 09:22:13 +00:00
|
|
|
this.taskmanager.start();
|
2024-05-11 10:51:20 +00:00
|
|
|
}
|
|
|
|
|
2024-08-27 09:22:13 +00:00
|
|
|
public updateTask = new plugins.taskbuffer.Task({
|
|
|
|
name: 'updateTask',
|
|
|
|
taskFunction: async () => {
|
|
|
|
await this.serviceworkerRef.cacheManager.cleanCaches('a new app version has been communicated by the server.');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2024-05-11 10:51:20 +00:00
|
|
|
}
|