Answer: Simulate multi-threading with "rotary time slices" (segments that perform multiple tasks in turn in a short period of time)

Method to realize:

  1. Existing task 1, task 2
  2. Split task 1 and task 2
  3. Randomly arrange these task fragments to form a queue
  4. Send the task fragments to the JS engine in this queue order
  5. The JS engine executes these task fragments in turn

海洋饼干
1.5k 声望191 粉丝