Jump to content
Search Community

onError handler ?

edbras test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

There is no such thing as a global onError because:

  1. It could significantly slow things down. try/catch blocks are notoriously S-L-O-W.
  2. Frankly, I've never needed that, nor has anyone requested it (that I can remember at least). If you're worried about creating tweens that generate errors, it's good to use something like Chrome Dev Tools and watch for them, but honestly they're pretty rare unless you try tweening a non-existent property or a null target, but those would generate errors anyway which you can easily detect in Dev Tools (or similar). 
  3. We try very hard to keep the file size to an absolutely minimum, so we don't want to sprinkle a bunch of error-sensing (and responding) code into the core.

You're welcome to add try...catch blocks around the main rendering loops in GSAP, but I really wouldn't recommend that due to the performance penalty. 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...