-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding safe event listeners, [Event] metadata autowiring, and a basic phase validation implementation. #7
base: master
Are you sure you want to change the base?
Conversation
…n signature, why not promote the importance of the useWeakListener argument? Also, drops the dependency on DisplayObject in favor of IEventDispatcher.
…te event callbacks that optionally accept the event argument.
…("eventName")] metadata. Autowires using safe listeners, so it's ok to annotate functions that don't take arguments.
…e phases and their order, then use invalidate to add instances to a phase at a certain depth. A phase expects each object to be validated to have a public method with the same name as the phase's name. For example: <code> addPhase("render", 1, true); invalidate({render: function(){ trace("render was called"); }}, 0, "render"); </code> Will trace out "render was called" on the next frame.
Hey Guy, Here're my thoughts on these changes for what they're worth.
I personally like strong links and manual removal but regardless of that, I think this should mirror what the addEventListener() function does by default which is useWeakReferences = false Actually, these two functions seem kinda useless to me. Do we really need a separate function just to suppress a potentially helpful error?
Cool idea. Needs an example use case. Seems like it could be too complex for an ad hoc utils lib but maybe not.
Cool! Needs example usage since it's not very clear from looking.
Again, looks like a micro-framework, possibly too complex for this library. Needs a good use case example. Sorry if these notes seem nit-picky! Thanks for contributing. Mims |
Thanks for taking the time to review this Mims. |
I merged 1. and switched it back to the default for addEventListener. |
…object doesn't have a public function implemented for the phase name. Fixed a bug where phases wouldn't validate a second time. oops.
Here are all 3 used together to draw pretty boxes when you mouse down, mouse up, and click. rendering is handled efficiently with invalidation, packaging calls made in quick succession into one validation loop.
Useful for anybody developing AS3 only display stuff, and things I've written over and over. They always end up in some utils package, I hoped this would be the last time. |
Looks pretty cool. I still think we need docs in the code itself. I'm going to defer to some of the other admins for their input before adding. Thanks for your patience. |
Hey Paul, can you write some passing tests around these? As far as the weak listener issue, I think if we're going to go against the default of AS3 then the method itself should indicate that the listeners will be weak by default. I wouldn't want people to use it without looking at the behavior and falsely assume that they're going to be non-weak. Perhaps two methods? addListenerToTarget() |
Points of interest/conflict (maybe):