feat(web-workers/filter-files): add web-worker to handle filtering off the main thread

This commit is contained in:
Aminejv 2021-09-24 18:14:35 +01:00
parent 5c069eb637
commit c0d396282b

8
workers/filter-files.js Normal file
View File

@ -0,0 +1,8 @@
import { getFilterHandler } from "~/common/filter-utilities";
onmessage = function (e) {
const { objects = [], view, subview, type } = e.data;
const filterCallback = getFilterHandler({ view, subview, type });
const result = objects.filter(filterCallback);
postMessage(result);
};