-
Notifications
You must be signed in to change notification settings - Fork 93
feat(dialogs/spawnDialog): return promise with the result #6758
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
Conversation
src/functions/dialog/index.ts
Outdated
element.remove() | ||
const result = rest.map(v => toRaw(v)) | ||
onClose?.(...result) | ||
resolve(result.length > 1 ? result : result[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you have to emit array or object your self?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, it's a common practice in Vue to always emit with one parameter in the payload. Then it's HTML-like and supports $event
in template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here, if you emit many values - you get an array.
And if you emitted 1 value - you get it directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but you only resolve the first argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I only resolve the first argument when there are no arguments after the first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@susnux It's me again.
What do you think about requiring to emit only one parameter? 👀
To keep description and typing simple.
Signed-off-by: Grigorii K. Shartsev <[email protected]>
9e491b1
to
f6aa944
Compare
☑️ Resolves
spawnDialog
or add a new function #6731onClose
callback, but also return a promise🏁 Checklist
stable8
for maintained Vue 2 version or not applicable