Skip to content
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

Wish List - Get rid of promises #16

Open
sethbrasile opened this issue Mar 27, 2016 · 3 comments
Open

Wish List - Get rid of promises #16

sethbrasile opened this issue Mar 27, 2016 · 3 comments

Comments

@sethbrasile
Copy link
Owner

I would love it if it was possible to open/close modals in quick succession without using promises. I believe this may be possible with ember-concurrency, but I don't want to add another dependency to the consuming app since this is, in fact, just a modal addon. Please leave a suggestion if you have one!

@sethbrasile sethbrasile changed the title Get rid of promises Wish List - Get rid of promises Mar 27, 2016
@sukima
Copy link

sukima commented Apr 2, 2018

I'm curious how ember-concurrency could help? Promises or co-routines the two would have the same issue. Aside from cancellation support which you could implement a simple case here if you assume you only want one modal open at a time. I'd like to hear more thoughts on how you feel e-c would help. And then discuss how you could accomplish the same thing with some fancy promise-chain footwork to avoid adding a dependency.

@sethbrasile
Copy link
Owner Author

@sukima this was a very long time ago (sorry, been away from developer-land for a few years...) so I could be misremembering:

From what I recall, I was wanting to internally track state so that the user didn't need to worry about it. I wonder if there was a reason I didn't think promises were the right route? I don't see why we couldn't internally track state with promises..

You know, I think I tried and maybe ran into issues stacking promises. I think I could get an open-close succession to work, but not open-close-open, so I ended up just returning the promise and letting the user handle it.

I'm sorry that I don't remember! If I get a chance, I can dive back into this, but I'm not sure.

@sukima
Copy link

sukima commented Dec 28, 2018

@sethbrasile You might be right. I cannot remember either. However I did do a lot of study into the remodal and ember-remodal code and developed a wrapper for it that I think handles the open-close-open for you. My ember add on ember-confirmed has a ember-remodal-redux component that moves the management of modals to the user via a manager API. Here is an example of such a use case: https://ember-twiddle.com/64bc114b4ba5b3ff6a2fb770d1946fed

The basic idea is that the ember-remodal-redux component handles the open and close promises for you the API you see as a developer is simply a Confirmer object. The addon offers a Manager object to open and close the modal programmatically.

ember-remodal-redux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants