sweet-modal-vue
sweet-modal-vue copied to clipboard
Suggestion - Pass params through in close/open methods
Since the modal doesn't work on a promise to contextually know when it's opened or closed as part of another method call it would be useful to be able to pipe through some arguments to the close method so we could tell the difference between a cancel and a completed operation.
Can you elaborate?
Yeah, sorry.
Ultimately, I have a method that makes ajax calls based on various button pushes. This method received some data, looks up an item which may have an optional callback, and then does the ajax request and some cleanup (like showing a toast on results).
I was trying to use the modal in one of those callbacks to ask the user about some options, and it ended up being kind of hacky to do so. Obviously, if I was able to know ahead of time that I needed a modal I could make it so one of the modal buttons directly triggered the ajax call and I'd already have the options handy.
I recognize this is an edge case, but the dream would be to be able to call modal.open and get a promise then be able to resolve that promise with whatever params are passed into modal.close. That way in a situation like mine I would be able to wait for user options and then know if the user canceled or gave me my options and react accordingly (all without the calling method necessarily knowing a modal was involved)
edit: at the time I needed 'anything' to work so I could wrap my feature and didn't look too closely at source, I would be willing to try and rustle up a PR if you're amenable to the feature.