Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebase Realtime Databaseをサービスで使った知見

Firebase Realtime Databaseをサービスで使った知見

Firebase Realtime Databaseをサービスのメインに使った上での知見です

Transcript

  1. let firstTimeBatchBeganTime = Infinity;! let watchStartTime = 0;! const TIMEOUT_MS

    = 1000;! const updateInitialMessageFlag = () => {! // If first message from firebase is not sent,! // we will wait again.! if (watchStartTime <= firstTimeBatchBeganTime) {! watchStartTime = Date.now();! setTimeout(updateInitialMessageFlag, TIMEOUT_MS);! }! TalkStore.isInitialMessage = false;! };! setTimeout(updateInitialMessageFlag, TIMEOUT_MS);!
  2. firebaseStream! .filter(({ type }) => {! return type === FirebaseEventType.CHILD_ADDED)!

    })! .buffer(Observable.interval(INTERVAL_MS))! .filter(v => v.length > 0)!