millermedeiros / js-signals

Custom Event/Messaging system for JavaScript inspired by AS3-Signals
http://millermedeiros.github.com/js-signals/
1.97k stars 179 forks source link

calling Signal methods after `Signal.dispose()` throws errors #26

Closed millermedeiros closed 13 years ago

millermedeiros commented 13 years ago

after dispose _bindings array is deleted so trying to add/remove/dispatch throws errors. is this the proper behavior?

So far I think it is the proper behavior since dispose is supposed to destroy the object and it is documented. Adding new listeners and dispatching should definitely throw errors, not sure about other methods..

maybe improve error message, something like: "Signal was previously disposed. You can't add new listeners or dispatch it.".

issue #25 is also related.

paullewis commented 13 years ago

Yeah, definitely the right behaviour as far as I'm concerned. I think your idea of improving the error message is a good one, but it shouldn't silently fail, that's for sure :)

millermedeiros commented 13 years ago

ignored.. just improved other error messages.. don't think the overhead pays-off.. will need checks everywhere and calling methods after dispose() shouldn't be that common.. error message + doc should be enough... releasing v0.6.3 without this.