How to use the @firebase/util.isEmpty function in @firebase/util

To help you get started, we’ve selected a few @firebase/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firebase / firebase-js-sdk / packages / database / src / core / Repo.ts View on Github external
onDisconnectUpdate(
    path: Path,
    childrenToMerge: { [k: string]: any },
    onComplete: ((status: Error | null, errorReason?: string) => void) | null
  ) {
    if (isEmpty(childrenToMerge)) {
      log(
        "onDisconnect().update() called with empty data.  Don't do anything."
      );
      this.callOnCompleteCallback(onComplete, 'ok');
      return;
    }

    this.server_.onDisconnectMerge(
      path.toString(),
      childrenToMerge,
      (status, errorReason) => {
        if (status === 'ok') {
          each(childrenToMerge, (childName: string, childNode: any) => {
            const newChildNode = nodeFromJSON(childNode);
            this.onDisconnect_.remember(path.child(childName), newChildNode);
          });
github firebase / firebase-js-sdk / packages / database / src / core / PersistentConnection.ts View on Github external
resume(reason: string) {
    log('Resuming connection for reason: ' + reason);
    delete this.interruptReasons_[reason];
    if (isEmpty(this.interruptReasons_)) {
      this.reconnectDelay_ = RECONNECT_MIN_DELAY;
      if (!this.realtime_) {
        this.scheduleConnect_(0);
      }
    }
  }
github firebase / firebase-js-sdk / packages / database / src / core / PersistentConnection.ts View on Github external
private shouldReconnect_(): boolean {
    const online = OnlineMonitor.getInstance().currentlyOnline();
    return isEmpty(this.interruptReasons_) && online;
  }
}
github firebase / firebase-js-sdk / packages / database / src / core / PersistentConnection.ts View on Github external
private shouldReconnect_(): boolean {
    const online = OnlineMonitor.getInstance().currentlyOnline();
    return isEmpty(this.interruptReasons_) && online;
  }
}
github firebase / firebase-js-sdk / packages / database / src / core / PersistentConnection.ts View on Github external
resume(reason: string) {
    log('Resuming connection for reason: ' + reason);
    delete this.interruptReasons_[reason];
    if (isEmpty(this.interruptReasons_)) {
      this.reconnectDelay_ = RECONNECT_MIN_DELAY;
      if (!this.realtime_) {
        this.scheduleConnect_(0);
      }
    }
  }
github firebase / firebase-js-sdk / packages / database / src / core / Repo.ts View on Github external
onDisconnectUpdate(
    path: Path,
    childrenToMerge: { [k: string]: any },
    onComplete: ((status: Error | null, errorReason?: string) => void) | null
  ) {
    if (isEmpty(childrenToMerge)) {
      log(
        "onDisconnect().update() called with empty data.  Don't do anything."
      );
      this.callOnCompleteCallback(onComplete, 'ok');
      return;
    }

    this.server_.onDisconnectMerge(
      path.toString(),
      childrenToMerge,
      (status, errorReason) => {
        if (status === 'ok') {
          each(childrenToMerge, (childName: string, childNode: any) => {
            const newChildNode = nodeFromJSON(childNode);
            this.onDisconnect_.remember(path.child(childName), newChildNode);
          });