Merge pull request #1210 from realm/depreciate-setAccessToken

Deprecate setAccessToken
This commit is contained in:
blagoev 2017-08-16 12:51:27 +03:00 committed by GitHub
commit cd187eca43
1 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,19 @@ module.exports = function(realmConstructor) {
setConstructorOnPrototype(realmConstructor.Sync.User);
setConstructorOnPrototype(realmConstructor.Sync.Session);
if (realmConstructor.Sync._setFeatureToken) {
realmConstructor.Sync.setFeatureToken = function(featureToken) {
if (typeof featureToken !== 'string' || !featureToken instanceof String) {
throw new Error("featureToken should be a string");
}
realmConstructor.Sync._setFeatureToken(featureToken.trim());
}
//enable deprecated setAccessToken
realmConstructor.Sync.setAccessToken = realmConstructor.Sync.setFeatureToken;
}
}
// TODO: Remove this now useless object.