mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-24 17:44:50 +03:00
feat(web-workers/filter-files): add web-worker to handle filtering off the main thread
This commit is contained in:
parent
5c069eb637
commit
c0d396282b
8
workers/filter-files.js
Normal file
8
workers/filter-files.js
Normal 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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user