Efficient Script Yielding with setImmediate()
Web developers commonly use the
setTimeout method has a specified period of zero. This can result in increased power consumption and decreased battery life because the CPU is unable to enter power-lowering sleep states.
setImmediate method can solve the problems of using
setTimeout by addressing the core performance problem without negatively impacting power consumption. As a result, web developers can use the
Here's how to use this new API. If you are currently using the following code:
var handle = setTimeout(spellCheck, 0);
var handle = setImmediate(spellCheck);