mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-10 05:37:08 +00:00
Merge branch 'master' of github.com:realm/realm-js into kneth/updating-tg-branch
This commit is contained in:
commit
12ac536d06
@ -95,7 +95,7 @@ class Realm {
|
|||||||
* Open a realm asynchronously with a promise. If the realm is synced, it will be fully
|
* Open a realm asynchronously with a promise. If the realm is synced, it will be fully
|
||||||
* synchronized before it is available.
|
* synchronized before it is available.
|
||||||
* @param {Realm~Configuration} config
|
* @param {Realm~Configuration} config
|
||||||
* @returns {Promise} - a promise that will be resolved with the realm instance when it's available.
|
* @returns {ProgressPromise} - a promise that will be resolved with the realm instance when it's available.
|
||||||
*/
|
*/
|
||||||
static open(config) {}
|
static open(config) {}
|
||||||
|
|
||||||
@ -104,9 +104,10 @@ class Realm {
|
|||||||
* synchronized before it is available.
|
* synchronized before it is available.
|
||||||
* @param {Realm~Configuration} config
|
* @param {Realm~Configuration} config
|
||||||
* @param {callback(error, realm)} - will be called when the realm is ready.
|
* @param {callback(error, realm)} - will be called when the realm is ready.
|
||||||
|
* @param {callback(transferred, transferable)} [progressCallback] - an optional callback for download progress notifications
|
||||||
* @throws {Error} If anything in the provided `config` is invalid.
|
* @throws {Error} If anything in the provided `config` is invalid.
|
||||||
*/
|
*/
|
||||||
static openAsync(config, callback) {}
|
static openAsync(config, callback, progressCallback) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes this Realm so it may be re-opened with a newer schema version.
|
* Closes this Realm so it may be re-opened with a newer schema version.
|
||||||
|
@ -76,13 +76,7 @@ module.exports = function(realmConstructor) {
|
|||||||
return promise;
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
openAsync(config, progressCallback, callback) {
|
openAsync(config, callback, progressCallback) {
|
||||||
|
|
||||||
if (!callback) {
|
|
||||||
callback = progressCallback;
|
|
||||||
progressCallback = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
realmConstructor._waitForDownload(config,
|
realmConstructor._waitForDownload(config,
|
||||||
(syncSession) => {
|
(syncSession) => {
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
|
4
lib/index.d.ts
vendored
4
lib/index.d.ts
vendored
@ -448,10 +448,10 @@ declare class Realm {
|
|||||||
/**
|
/**
|
||||||
* Open a realm asynchronously with a callback. If the realm is synced, it will be fully synchronized before it is available.
|
* Open a realm asynchronously with a callback. If the realm is synced, it will be fully synchronized before it is available.
|
||||||
* @param {Configuration} config
|
* @param {Configuration} config
|
||||||
* @param {ProgressNotificationCallback} progressCallback? a progress notification callback for 'download' direction and 'forCurrentlyOutstandingWork' mode
|
|
||||||
* @param {Function} callback will be called when the realm is ready.
|
* @param {Function} callback will be called when the realm is ready.
|
||||||
|
* @param {ProgressNotificationCallback} progressCallback? a progress notification callback for 'download' direction and 'forCurrentlyOutstandingWork' mode
|
||||||
*/
|
*/
|
||||||
static openAsync(config: Realm.Configuration, progressCallback?: Realm.Sync.ProgressNotificationCallback, callback: (error: any, realm: Realm) => void): void
|
static openAsync(config: Realm.Configuration, callback: (error: any, realm: Realm) => void, progressCallback?: Realm.Sync.ProgressNotificationCallback): void
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the Realm file for the given configuration.
|
* Delete the Realm file for the given configuration.
|
||||||
|
@ -626,9 +626,6 @@ module.exports = {
|
|||||||
let progressCalled = false;
|
let progressCalled = false;
|
||||||
|
|
||||||
Realm.openAsync(config,
|
Realm.openAsync(config,
|
||||||
(transferred, total) => {
|
|
||||||
progressCalled = true;
|
|
||||||
},
|
|
||||||
(error, realm) => {
|
(error, realm) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
@ -637,6 +634,9 @@ module.exports = {
|
|||||||
|
|
||||||
TestCase.assertTrue(progressCalled);
|
TestCase.assertTrue(progressCalled);
|
||||||
resolve();
|
resolve();
|
||||||
|
},
|
||||||
|
(transferred, total) => {
|
||||||
|
progressCalled = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user