frappe icon indicating copy to clipboard operation
frappe copied to clipboard

Add a public non-factory constructor for Property

Open danschultz opened this issue 11 years ago • 2 comments

It's not possible to sub-class Property from a non frappe library.

class Property<T> extends Reactable<T> {
  Property._(Stream<T> stream, bool hasInitialValue, [T initialValue]) {
    ...
  }

  Property(Stream<T> stream) => this._(stream, false);
  Property.withInitialValue(T initialValue, Stream<T> stream) => this._(stream, true, initialValue);
}

Deprecate factory constructors for Property.fromStream() and Property.fromStreamWithInitialValue().

danschultz avatar Mar 25 '15 20:03 danschultz

:+1: for the feature and the discussion you guys had https://github.com/danschultz/frappe/issues/40

@danschultz I'm thinking about sending a pr. do you have a guideline I should follow?

alexvbush avatar Apr 30 '15 07:04 alexvbush

@alexvbush, my plan was to add two new non-factory constructors Property(Stream<T> stream) and Property.withInitialValue(T initialValue, Stream<T> stream). This API is more inline with how the EventStream's constructor works.

Thanks for considering making a contribution. It's much appreciated!

danschultz avatar May 01 '15 07:05 danschultz