UNPKG

lil-http

Version:

Tiny, lightweight, full featured HTTP client

30 lines (25 loc) 713 B
<html> <head> <meta charset="utf-8"> </head> <body> <script src="../thread.js"></script> <script> // createThreads while (thread.total() < 5) { thread() } console.log('Idle threads:', thread.idle()) var worker = thread.idle()[0] worker.run(function (done) { setTimeout(done, 100) }) console.log('Running threads:', thread.running()) console.log('Idle threads:', thread.idle()) worker.kill() console.log('Created threads after kill:', thread.total()) setTimeout(function () { thread.killAll() console.log('Running threads after kill all:', thread.total()) }, 200) </script> </body> </html>