-
Notifications
You must be signed in to change notification settings - Fork 9
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
Message API Improvements #349
Conversation
Hi: One thing to consider when we review this if we want to actually completely hide the Message/Message Model API as renamed impl classes. (If we did so, we could actually grab those cleaner names for the MessageSource and MessageSourceModel classes.) One thing that the direct use of a MessageModel gives us is the ability to use a single message, when an application wants to ensure it never shows multiple copies of the same message. This could be accomplished by providing a string id to MessageSourceModel.alert() to indicate what existing model to use, if any.... It also gives us the ability to conveniently set reusable defaults, but not clear how useful that is -- and application could always define a constant for that.... |
cmp/message/MessageModel.js
Outdated
@@ -8,10 +8,18 @@ import {observable, action} from '@xh/hoist/mobx'; | |||
import {HoistModel} from '@xh/hoist/core'; | |||
|
|||
/** | |||
* Model for convenient, imperative Alerting/Confirming. | |||
* Model imperative Alerting/Confirming. |
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.
fix grammar
cmp/message/MessageModel.js
Outdated
@@ -37,7 +45,7 @@ export class MessageModel { | |||
/** | |||
* @param {Object} [config] - default options for this instance. | |||
*/ | |||
constructor(config) { | |||
constructor(config, parent) { |
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.
remove obsolete parent argument
cmp/message/MessageModel.js
Outdated
@@ -8,10 +8,18 @@ import {observable, action} from '@xh/hoist/mobx'; | |||
import {HoistModel} from '@xh/hoist/core'; | |||
|
|||
/** | |||
* Model for convenient, imperative Alerting/Confirming. | |||
* Model imperative Alerting/Confirming. |
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.
...for...
core/XH.js
Outdated
} | ||
|
||
/** | ||
* Show an alert dialog. |
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.
confirm dialog
OK -- cleaned this up substantially after jbar and atm review. I think this is much more straightforward. Documentation greatly improved as well. |
This change avoids the requirement of creating explicit Message/MessageModel pairs in order to show alerts and confirms.
For most applications uses, XH.alert() and XH.confirm() will suffice to display a disposable, one-time message