Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Make ReactiveView read-only by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticfall committed Nov 9, 2020
1 parent 5d9fe1a commit 43ac654
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions alleycat/reactive/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ def new_property(read_only=False) -> ReactiveProperty:
return ReactiveProperty(Nothing, read_only)


def new_view(read_only=False) -> ReactiveView:
def new_view(read_only=True) -> ReactiveView:
return ReactiveView(RequiresContext(lambda _: rx.empty()), read_only)


def from_value(value: Optional[T], read_only=False) -> ReactiveProperty[T]:
return ReactiveProperty(Maybe.from_optional(value), read_only)


def from_observable(value: Optional[Observable] = None, read_only=False) -> ReactiveView:
def from_observable(value: Optional[Observable] = None, read_only=True) -> ReactiveView:
init_value: RequiresContext[Observable, Any] = \
RequiresContext(lambda _: Maybe.from_optional(value).value_or(rx.empty()))

return ReactiveView(init_value, read_only)


def from_instance(value: Callable[[Any], Observable], read_only=False) -> ReactiveView:
def from_instance(value: Callable[[Any], Observable], read_only=True) -> ReactiveView:
return ReactiveView(RequiresContext(value), read_only)


Expand Down

0 comments on commit 43ac654

Please sign in to comment.