-
Notifications
You must be signed in to change notification settings - Fork 42
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
'unload' handler is not called #91
Comments
Thanks for the detailed report, I'm going to test it as soon as possible. |
I've updated the tests (they failed to reproduce this problem in the first place) and fixed the _onModuleUnload method. This branch should solve the issue: |
Rik, thanks for the fix. I'll check the fix soon. |
You're welcome :) |
Merged in version 1.2.2 |
I'm trying to subscribe to
'unload'
event of modules initialized on selected DOM nodes.My implementation is based on example shown here: http://conditionerjs.com/docs/#conditioner-sync
The effects are:
'load'
event if fired and the handler is called - this works fine'unload'
does not fire - this isn't working as it shouldThe call stack is briefly as follows:
ModuleController
's_unload
publishes'unload'
eventObserver.publish
goes to line that executes matched callbacks (matches[i].fn(data);
)NodeController._onModuleUnload
(this empties thereceivers
array fromObserver.publish
)Observer.publish
receivers
are now empty so it doesn't go into the for loop (which would publish'unload'
)If I remove the line with
Observer.conceal(moduleController,this);
fromNodeController
's_onModuleUnload
handler the'unload'
handler is working fine.If you compare
_onModuleUnload
with_onModuleLoad
then you'll see thatObserve.conceal
isn't called in the onload handler. What's the purpose of calling it in_onModuleUnload
?The text was updated successfully, but these errors were encountered: