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

0.9: String literals as parameters of computed properties #1475

Closed
miztroh-zz opened this issue May 1, 2015 · 2 comments
Closed

0.9: String literals as parameters of computed properties #1475

miztroh-zz opened this issue May 1, 2015 · 2 comments
Assignees
Labels

Comments

@miztroh-zz
Copy link

Any chance Polymer will support string literals as parameters of computed properties? Here's a simplified use case from something I'm working on.

Polymer(
    {
        formatDate: function (format, dateObject) {
            return date(format, dateObject.getTime() / 1000);
        },
        is: 'date-formatter',
        properties: {
            date: {
                type: Date,
                notify: true,
                value: new Date()
            },
            year: {
                type: Number,
                computed: 'formatDate("Y", date)'
            }
        }
    }
);

As it is, I have to create other properties for format strings.

Polymer(
    {
        formatDate: function (format, dateObject) {
            return date(format, dateObject.getTime() / 1000);
        },
        is: 'date-formatter',
        properties: {
            date: {
                type: Date,
                notify: true,
                value: new Date()
            },
            year: {
                type: String,
                computed: 'formatDate(yearFormat, date)'
            },
            yearFormat: {
                type: String,
                value: 'Y'
            }
        }
    }
);
@sorvell
Copy link
Contributor

sorvell commented May 5, 2015

Thanks for the feedback. We think this would be a powerful addition to computed properties and we're looking into supporting it.

@miztroh-zz miztroh-zz changed the title 0.8: String literals as parameters of computed properties 0.9: String literals as parameters of computed properties May 8, 2015
@sorvell sorvell added p2 and removed p1 labels May 21, 2015
@kevinpschaaf kevinpschaaf added p1 and removed p2 labels May 22, 2015
@kevinpschaaf
Copy link
Member

Fixed in #1577

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

No branches or pull requests

4 participants