-
Notifications
You must be signed in to change notification settings - Fork 79
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
Implement Context.unsubscribe() method #18
Comments
You are correct here. Do you have an implementation already for it, which we may pull? Meanwhile try not to depend on the events too much.. i believe it is much better to use URLController as much as possible as that will let you to bookmark and use browser back button. |
I don't have implementation yet, though it's straightforward. Will prepare next week. |
Btw is unsubscribe the best name for this method?
what are the alternatives? |
Yes, publish, subscribe, unsubscribe style is a better use of names |
do you mean we should rename |
Yes.. but BoilerplateJS is not intended to be used as a typical JS library, but as a reference architecture. It is just your own startup code.. you will be changing it a lot to suit your needs. When you do changes to that level, there is no simple way to upgrade to latest versions, unless someone do it manually. Therefore I dont think it has to be backward compatible. |
Don't you feel the need for
Context.unsubscribe()
method?E.g. I want my component to listen for event only if it is active. So i call
Context.listen()
in component's.activate()
function (imagine I don't use viewmodels). Currently there is no way to unsubscribe when the component is deactivated, meaning the event handler will be called anyway. But i don't want to handle this event when the component is hidden because e.g. it changes look&feel of component based on event data - it's a waste of resources.The text was updated successfully, but these errors were encountered: