Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually recalculate 'computed properties'

If I have a custom element

Polymer({
  name: 'dane',

  computed: {
    message: 'greet(name)'
  },

  greet: function(name) {
    return 'hello ' + name + Date.now();
  }
})

When I change name polymer will automatically recompute message, but is there a way to recompute message without changing name?

like image 790
Dane O'Connor Avatar asked Sep 30 '22 07:09

Dane O'Connor


1 Answers

You could add another input value to the compute expression, i.e.:

message: 'greet(name,x)'

and then force a re-compute by updating x.

Keep in mind computed properties are read-only so you can't directly assign it a value.

like image 103
sfeast Avatar answered Oct 18 '22 22:10

sfeast