Fix Object.setPrototypeOf issue on Android (#1195)

* Fix Object.setPrototypeOf issue on Android

* Fix prototype chain
This commit is contained in:
Kristian Dupont 2017-08-09 15:08:19 +02:00 committed by GitHub
parent ee3b855efb
commit bb3411f7f7
1 changed files with 9 additions and 2 deletions

View File

@ -44,8 +44,15 @@ PersonObject.prototype.description = function() {
PersonObject.prototype.toString = function() {
return this.name;
};
Object.setPrototypeOf(PersonObject, Realm.Object);
Object.setPrototypeOf(PersonObject.prototype, Realm.Object.prototype);
// Object.setPrototypeOf doesn't work on JSC on Android. The code below achieves the same thing.
//Object.setPrototypeOf(PersonObject, Realm.Object);
//Object.setPrototypeOf(PersonObject.prototype, Realm.Object.prototype);
PersonObject.__proto__ = Realm.Object;
PersonObject.prototype.__proto__ = Realm.Object.prototype;
exports.PersonObject = PersonObject;
exports.PersonList = {