Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread cannot run separately #92

Open
nagaraj95 opened this issue Nov 20, 2019 · 0 comments
Open

Thread cannot run separately #92

nagaraj95 opened this issue Nov 20, 2019 · 0 comments

Comments

@nagaraj95
Copy link

nagaraj95 commented Nov 20, 2019

@Traviskn i am using initially to get the data from local db and sets the data to UI. After tat I invoke a function to sync data to local db with the server, while syncing with server i cannot able to perform a operation like on-press. So i used this library to run that function in separate thread to avoid that UI block operation, but at ta time also the UI blocks after the execution of the function i can able to perform the operation on-press.I used the syntax like tis

 const thread = new Thread('app/thread.js')         
        thread.postMessage('hello');
         thread.onmessage = (message) => {
             console.log("-------" + message);
             this.syncDbWithServer()
         }

Thread.js file

import { self } from 'react-native-threads'; self.onmessage = async (message) => { console.log("msg----", message) self.postMessage('11111111111'); }
Is there any solution for tis. Thanks in advance.

@nagaraj95 nagaraj95 reopened this Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant