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

Proposed method: showText() #61

Closed
redbassett opened this issue Jan 26, 2016 · 3 comments
Closed

Proposed method: showText() #61

redbassett opened this issue Jan 26, 2016 · 3 comments

Comments

@redbassett
Copy link
Contributor

As noted in #50, this is a proposal to add an alias method showText() that combines commonly used lines of code:

myToast.text = "Hello World!";
myToast.show();
myToast.showText("Hello World!");

This method would serve to reduce the need to use the two lines in the former snippet in conjunction, especially if the setting and immediate showing of text in a <paper-toast> element is a common action across an app or component.

@valdrinkoshi
Copy link
Member

What if instead we have a properties object passed to show method?
Something like:

myToast.show({
  text: "Hello World",
  duration: 3000
});

The toast will either set the new values or keep the old ones, and open the toast right after.

If properties is a string, we can assume it is the text property, which will allow to just call

myToast.show("Hello World");

This is compatible with the old usage of show too 🎉

cc/ @cdata @notwaldorf

@redbassett
Copy link
Contributor Author

I like that idea!

Backwards compatible and doesn't require the redundant method!

@valdrinkoshi
Copy link
Member

@redbassett feel free to open a PR for this if you feel like it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants