资 源 简 介
Summary:
Most of the current browsers run javascript functions/loops within a single thread causing the browser to freeze while executing a long running loop or function, and may cause the browser to display the "Unresponsive script" message. This library attempts to work around those issues.
JThread provides the following features: -
1. Allows starting multiple threads and running them concurrently.
1. Doesn"t freeze the browser while executing a long running loop within a thread.
1. Each running thread can be killed at any time.
## Example 1: ##
//instantiate a JThread objectvar jThread = new JThread(loopBody, exitCondition);...//start threadjThread.run();...//kill threadjThread.kill();......//instantiate and run a JThread objectvar jThread = new JThread(loopBody, exitCondition).run();...//kill threadjThread.kill();...
## Example 2: ##
//to loop through a big arrayvar bigArr = [...];//instanti