[WIP] Added scheduler

This commit is contained in:
2023-04-16 21:46:17 +02:00
parent 39ca803d36
commit aabbfeaa92
51 changed files with 572 additions and 71 deletions

View File

@@ -0,0 +1,24 @@
from typing import Type
from cpl_core.type import T
from cpl_reactive_extensions.subject.subject import Subject
class BehaviorSubject(Subject):
def __init__(self, _t: Type[T], value: T):
Subject.__init__(self, _t)
if not isinstance(value, _t):
raise TypeError(f"Expected {_t.__name__} not {type(value).__name__}")
self._t = _t
self._value = value
@property
def value(self) -> T:
return self._value
def next(self, value: T):
super().next(value)
self._value = value