SHARE
TWEET

Untitled

a guest Dec 2nd, 2019 129 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { main, worker, spawn, marshal } from 'recursive-worker'
  2.  
  3. @marshal() class Program {
  4.  
  5.     run() {
  6.        
  7.         console.log('hello world')
  8.      }
  9. }
  10.  
  11. @worker() class Thread {
  12.  
  13.     run(program: Program) {
  14.  
  15.         program.run()
  16.     }
  17. }
  18.  
  19.  
  20. main(async () => {
  21.  
  22.     const thread = spawn(Thread)
  23.  
  24.     await thread.run(new Program())
  25.  
  26.     await thread.dispose()
  27. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top