How to use the realm.openAsync function in realm

To help you get started, we’ve selected a few realm 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 realm / realm-js / tests / js / session-tests.js View on Github external
return new Promise((resolve, reject) => {
                    let config = {
                        sync: {
                            user,
                            url: `realm://127.0.0.1:9080/~/${realmName}`
                        },
                        schema: [{ name: 'Dog', properties: { name: 'string' } }],
                    };

                    let progressCalled = false;

                    Realm.openAsync(config,
                        (error, realm) => {
                            if (error) {
                                reject(error);
                                return;
                            }

                            TestCase.assertTrue(progressCalled);
                            resolve();
                        },
                        (transferred, total) => {
                            progressCalled = true;
                        });

                    setTimeout(function() {
                        reject("Progress Notifications API failed to call progress callback for Realm constructor");
                    }, 5000);