-
Notifications
You must be signed in to change notification settings - Fork 46
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
Feature/add destroy function to store #57
Feature/add destroy function to store #57
Conversation
fadc11c
to
5ffd20b
Compare
This is really clean, I dig it! I particularly like the pattern of returning the "unsubscribe" version of the function from adding event listeners and optionally returning a destroy method from init. I think the only thing missing here is just some documentation for the But overall, very nice. |
Glad you like it so far. I would still need some help with this stuff here (may be affected by it) Otherwise, I can add documentation on this for sure |
148fb0b
to
a750efe
Compare
Updated docs to cover |
I'm still on vacation in Sweden. Thanks for your patience. Will try to review properly and merge sometime after I get back. |
hey @rudionrails! I finally had a chance to do this. I ended up actually removing the explicit I did this because I didn't want to introduce multiple ways to do the same thing. And especially in the case of event listeners it seemed more likely that you've have the relevant listeners available in scope by doing it in init. Plus... it more closely matches patterns established elsewhere in the code. Hope that's ok. Anyway... released at |
Perfect. Thanks :) |
TL;DR
store.destroy()
to remove event listeners, unsubscribe from store listeners or cleanup state.Synopsis
This feature has 2 interfaces: either return a function from
bundle.init()
or explicitly declarebundle.destroy()
. Both also work together. It is a 1-way final method - no option to revert or re-initialize the store again. Seetest/destroy.js
for reference.