next(null)在BehaviourSubject上不起作用

时间:2019-12-10 09:26:40

标签: angular rxjs behaviorsubject

我有一个BehaviorSubject对象,其初始化如下:

{[s]:number}

在应用程序生命周期的整个过程中,我将其设置如下:

  if #available(iOS 13.0, *) {
    let statusBarFrame = UIView(frame: UIApplication.shared.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero)
     statusBarFrame.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
     UIApplication.shared.keyWindow?.addSubview(statusBarFrame)
} else {
     UIApplication.shared.statusBarView?.backgroundColor = UIColor.init(red: 243/250, green: 243/250, blue: 243/250, alpha: 1)
}

但是,当我要将其设置为null时,它将被忽略并且状态不会更新:

// Note value is an URL to an existing image 
// retrieved via an API call later on
let value = null;
navbarLogoImage = new BehaviorSubject<string>(value);

我该如何解决?

0 个答案:

没有答案