Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { main, worker, spawn, marshal } from 'recursive-worker'
- @marshal() class Program {
- run() {
- console.log('hello world')
- }
- }
- @worker() class Thread {
- run(program: Program) {
- program.run()
- }
- }
- main(async () => {
- const thread = spawn(Thread)
- await thread.run(new Program())
- await thread.dispose()
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement