Jump to content
Search Community

How to trace that plugin was not activated?

Ethan Kennerly test
Moderator Tag

Recommended Posts

Sometimes I use a plugin's property without activating that plugin.

Of course that is my fault and I fixed it.

However, I find it helpful to be notified that the plugin was not activated.

Currently I inserted into the TweenLite.as function _initProps (line 574):

 

 

                } else {
                    if (!target.hasOwnProperty(p)) {
                        trace("TweenLite._initProps:", p, 
                            "is not an activated plugin and not a property of", target, 
                            ". Creating PropTween.");
                    }

 

I hesitate to touch the source code, which would be replaced when a new version is released.

Do you recommend another way to see a trace statement when the property has not been activated?Can you you see examples of problems with this trace technique?
 
Thank you for reading!
Link to comment
Share on other sites

I wish it were that simple, but there are a few problems with using hasOwnProperty() like that:

  1. It slows everything down because literally every property of every tween would have to get verified that way (an extra function call for each). We place a huge priority on performance and sometimes there are tradeoffs, but I think in this case it's better to have you run into a few runtime errors due to you forgetting to activate the plugin (and hopefully that won't be too difficult to figure out because you'll have the errors to point you in that direction anyway) instead of making everyone's tweens eat up more resources and slow the engine down just to provide a debugging convenience. Not to downplay the value of help during debugging - I'm just saying that the cost outweighs the benefit in this case (my opinion at least).
  2. The hasOwnProperty() doesn't report true for inherited properties/methods.
  • Like 1
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...