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

Add ability to change text when stopping and persisting #35

Merged
merged 3 commits into from
Jan 20, 2017
Merged

Add ability to change text when stopping and persisting #35

merged 3 commits into from
Jan 20, 2017

Conversation

insin
Copy link
Contributor

@insin insin commented Jan 17, 2017

Makes it more convenient to set a new past-tense message when stopping.

(Partial implementation of #28)


### .stopAndPersist([symbol])
### .stopAndPersist([symbol[, text]])
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if it's a better idea to use an options object here. Both symbol and text are optional and this way it's not possible to change the text without providing the symbol.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trying that out and it feels much nicer 👍

Stop the spinner, change it to `symbol` (or `' '` if `symbol` is not provided) and persist the `text`. Returns the instance. See the GIF below.
Stop the spinner and change the symbol or text. Returns the instance. See the GIF below.

If a string is provided, it is treated as a shortcut for [`options.symbol`](#symbol).
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should just remove the symbol argument support (while still supporting it for backwards-compatibility).


##### options

Type: `object`
Copy link
Owner

Choose a reason for hiding this comment

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

object => Object

###### text

Type: `string`<br>
Default: current `text`
Copy link
Owner

Choose a reason for hiding this comment

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

current => Current

###### symbol

Type: `string`<br>
Default: `' '`
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think the default is an empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The effective default is options.symbol || ' ', or should we just say something like 'Clear the symbol'?

Copy link
Owner

Choose a reason for hiding this comment

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

Nah, it's good.


Stop the spinner, change it to a red `✖` and persist the `text`. Returns the instance. See the GIF below.
Stop the spinner, change it to a red `✖` and persist `text` (or `.text` if `text` is not provided). Returns the instance. See the GIF below.
Copy link
Owner

Choose a reason for hiding this comment

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

(or .text if text is not provided)

Not clear enough what this means. Would be better to just explain it. For example:

and persists the current text or text if provided.

}
stopAndPersist(symbol) {
stopAndPersist(options) {
if (typeof options === 'string') {
Copy link
Owner

Choose a reason for hiding this comment

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

Add a comment above here with the following:

// Legacy argument
// TODO: Deprecate sometime in the future

@sindresorhus sindresorhus merged commit ad2a191 into sindresorhus:master Jan 20, 2017
@sindresorhus
Copy link
Owner

Looks great. Thank you :)

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.

3 participants