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

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

      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
            Reporter:
            Unito Sync Bot
            Archiver:
            Marc Greenfield

              Created:
              Updated:
              Resolved:
              Archived: