canjs / can-observable-mixin

Define properties on JavaScript classes
https://canjs.com
MIT License
2 stars 1 forks source link

Properties using value behaviors should not be serialized by default #129

Closed phillipskevin closed 5 years ago

phillipskevin commented 5 years ago

In the following example:

class Obs extends ObservableObject {
  static props = {
    prop: String,
    count: {
      value({ listenTo, resolve }) {
        let count = resolve(0);
        listenTo("prop", () => resolve(++count));
      }
    }
  };
}

const obs = new Obs();

...obs.serialize should not contain count unless the use specifies enumerable: true.