astoilkov / main-thread-scheduling

Fast and consistently responsive apps using a single function call
MIT License
1.29k stars 32 forks source link

Fix error when `requestIdleCallback` is unsupported #14

Closed cyreb7 closed 7 months ago

cyreb7 commented 7 months ago

We just started using Main Thread Scheduling and were surprised to find it throwing errors on iOS (it still functions correctly, but no reason to unnecessarily fill the error logs):

Can't find variable: cancelIdleCallback

It turns out the RicTracker@start() function returns if requestIdleCallback is unsupported, but RicTracker@stop() doesn't.

astoilkov commented 7 months ago

It seems I've missed that after the library rewrite. Thanks for your contribution! I just published a new patch release.