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

Message API Improvements #349

Merged
merged 6 commits into from
Jun 6, 2018
Merged

Message API Improvements #349

merged 6 commits into from
Jun 6, 2018

Conversation

lbwexler
Copy link
Member

@lbwexler lbwexler commented Jun 5, 2018

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

@lbwexler lbwexler requested review from a user and amcclain June 5, 2018 21:44
@lbwexler
Copy link
Member Author

lbwexler commented Jun 5, 2018

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....

@@ -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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix grammar

@@ -37,7 +45,7 @@ export class MessageModel {
/**
* @param {Object} [config] - default options for this instance.
*/
constructor(config) {
constructor(config, parent) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove obsolete parent argument

@@ -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.
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm dialog

@lbwexler
Copy link
Member Author

lbwexler commented Jun 6, 2018

OK -- cleaned this up substantially after jbar and atm review. I think this is much more straightforward.

Documentation greatly improved as well.

@amcclain amcclain merged commit 99d9c5e into develop Jun 6, 2018
@amcclain amcclain deleted the messageManager branch June 6, 2018 22:23
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

Successfully merging this pull request may close these issues.

2 participants