Adding documentation, TS definition and change log.

This commit is contained in:
Kenneth Geisshirt 2017-09-27 17:53:09 +02:00
parent e669a221a1
commit f94f351bfb
4 changed files with 72 additions and 54 deletions

View File

@ -1,3 +1,15 @@
x.x.x Release notes (yyyy-MM-dd)
=============================================================
### Breaking changes
* `Realm.Sync.initialize()` must be called prior to any interaction with any Realm Object Server.
### Enhancements
* None.
### Bug fixes
* None.
2.0.0 Release notes (2017-9-26)
=============================================================
### Breaking changes

View File

@ -20,6 +20,11 @@
* @memberof Realm
*/
class Sync {
/**
* Initialize the interaction with Realm Object Server. It should only be called once.
*/
static initialize() {}
/**
* Add a sync listener to listen to changes across multiple Realms
* @param {string} server_url - the sync server to listen to

7
lib/index.d.ts vendored
View File

@ -288,7 +288,7 @@ declare namespace Realm.Sync {
openManagementRealm(): Realm;
retrieveAccount(provider: string, username: string): Promise<Account>;
getGrantedPermissions(recipient: 'any' | 'currentUser' | 'otherUser'): Results<Permission>;
getGrantedPermissions(recipient: 'any' | 'currentUser' | 'otherUser'): Results<Permission>;
applyPermissions(condition: PermissionCondition, realmUrl: string, accessLevel: AccessLevel): Promise<PermissionChange>;
offerPermissions(realmUrl: string, accessLevel: AccessLevel, expiresAt?: Date): Promise<string>;
acceptPermissionOffer(token: string): Promise<string>
@ -300,7 +300,7 @@ declare namespace Realm.Sync {
{ metadataKey: string, metadataValue: string }
};
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
class Permission {
readonly id: string;
@ -396,6 +396,7 @@ declare namespace Realm.Sync {
function removeListener(regex: string, name: string, changeCallback: (changeEvent: ChangeEvent) => void): void;
function setLogLevel(logLevel: 'all' | 'trace' | 'debug' | 'detail' | 'info' | 'warn' | 'error' | 'fatal' | 'off'): void;
function setFeatureToken(token: string): void;
function initialize(): void;
/**
* @deprecated, to be removed in 2.0
@ -437,7 +438,7 @@ declare namespace Realm.Sync {
interface ProgressPromise extends Promise<Realm> {
progress(callback: Realm.Sync.ProgressNotificationCallback) : Promise<Realm>
progress(callback: Realm.Sync.ProgressNotificationCallback): Promise<Realm>
}
declare class Realm {

View File

@ -651,7 +651,7 @@ void SyncClass<T>::initialize(ContextType ctx, FunctionType, ObjectType this_obj
// setup synced realmFile paths
ensure_directory_exists_for_file(default_realm_file_directory());
SyncManager::shared().configure_file_system(default_realm_file_directory(), SyncManager::MetadataMode::NoEncryption);
return_value.set(Nan::Undefined());
return_value.set_undefined();
}
} // js
} // realm