简体   繁体   中英

Can I use Worker class in React Native?

Can I do something like

let worker = new Worker("./module.js", {type: "module"});

within the context of react-native ? Does it run the module in background thread? If so, who is handling the thread marshaling? I am thinking this is not possible in the context of react-native since Worker relies on HTML5. Confirmation?

I'm pretty sure you need a 3rd party library for this: https://www.npmjs.com/package/react-native-workers

Once you've got it installed just override Worker :

import { Worker } from 'react-native-workers';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM