Polymer / pwa-helpers

Small helper methods or mixins to help you build web apps.
BSD 3-Clause "New" or "Revised" License
440 stars 48 forks source link

Add oldState value in stateChanged mixin #66

Open theolavaux opened 4 years ago

theolavaux commented 4 years ago

Would it possible to add an oldState value object to the Javascript mixin stateChanged ? I'm using LitElement with Redux and it's a bit cumbersome to have to bind a class variable to a Redux variable to track previous changes regarding this variable.

const user = { age: '20', lastname: 'Johnson', firstname: 'Mark' }

If I have this object in Redux for example, and I would like to access to the old value firstname, I would have to bind it to a class variable using this._firstname = state.... in the stateChanged mixin.