Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-2594

Add optional callbacks to the Realm config to run on open and close

      Look into adding the possibility for developers to provide callbacks in the Realm config to run when:

      • The realm has just been opened.
        • E.g. onOpen, onAfterOpen (or onEveryOpen if a clearer distinction between that and our existing onFirstOpen is preferable).
      • The realm is about to be closed.
        • E.g. onClose, onBeforeClose.

      This could be a convenient way to set up (on open) and remove (on close) listeners, but also perform various logging in relation to these events. (The callbacks can receive the realm as an argument.)

      This could either (a) be added to the Realm config or (b) be realm/react-specific by only having them as props to RealmProvider and letting realm/react invoke the callbacks.

      Currently, for setting up listeners on the realm when using useRealm(), this logic has to be separated from RealmProvider as the hook should only be used in a child component of that provider.

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: