Пример #1
0
 def __init__(self,name):
     '''
     Constructor
     '''
     Observer.__init__(self)
     self.name=name
     self.outputStream = Subject()
Пример #2
0
  def subscribe(self, observerOrOnNext=noop, onError=noop, onComplete=noop):
    observer = observerOrOnNext

    if observerOrOnNext == None or callable(observerOrOnNext):
      observer = Observer.create(observerOrOnNext, onError, onComplete)

    return self.subscribeCore(observer)
Пример #3
0
  def subscribe(self, observerOrOnNext=noop, onError=noop, onComplete=noop):
    observer = observerOrOnNext

    if observerOrOnNext == None or hasattr(observerOrOnNext, '__call__'):
      observer = Observer.create(observerOrOnNext, onError, onComplete)

    autoDetachObserver = AutoDetachObserver(observer)

    if Scheduler.currentThread.isScheduleRequired():
      Scheduler.currentThread.scheduleWithState(autoDetachObserver, self.scheduledSubscribe)
    else:
      try:
        autoDetachObserver.disposable(self.subscribeCore(autoDetachObserver))
      except Exception as e:
        if not autoDetachObserver.fail(e):
          raise e

    return autoDetachObserver
Пример #4
0
 def synchronize(subject, scheduler=None):
     if scheduler == None:
         return AnonymousSubject(Observer.synchronize(subject), subject)
     else:
         return AnonymousSubject(Observer.synchronize(subject),
                                 subject.observeOn(scheduler))
Пример #5
0
 def __init__(self,name):
      
     Observer.__init__(self)       
Пример #6
0
 def synchronize(subject, scheduler=None):
   if scheduler == None:
     return AnonymousSubject(Observer.synchronize(subject), subject)
   else:
     return AnonymousSubject(Observer.synchronize(subject), subject.observeOn(scheduler))