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

feature(async): support async func in action and manual to close child worker #16

Open
wants to merge 3 commits into
base: support-async-post
Choose a base branch
from

Conversation

GitHubJiKe
Copy link

To resolve issues: setInterval dosen't work of vue-worker, add async way to handle action's func

@GitHubJiKe
Copy link
Author

GitHubJiKe commented Feb 9, 2022

example code:

SWorker.run(async () => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve('SWorker run 1: Function in other thread')
    }, 2000)
  });
})
  .then((res)=>{
console.log(res.data);
setTimeout(()=>{
    res.close();// after 3 seconds close the running worker
},3000)
}) // logs 'SWorker run 1: Function in other thread'
  .catch(console.error) // logs any possible error

@israelss israelss changed the base branch from master to support-async-post March 28, 2022 20:46
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

Successfully merging this pull request may close these issues.

None yet

1 participant