Created
June 6, 2016 10:10
-
-
Save PyYoshi/58ac9a2891bb1ceed1e7bdd9b2bd63c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep() { | |
var ms = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; | |
return new Promise( | |
function (r) { | |
return setTimeout(r, ms); | |
} | |
); | |
} | |
var writeTransactionCreateCarAndPerson3 = function writeTransactionCreateCarAndPerson3() { | |
var realm = new _realm2.default({ schema: [Car, Person] }); | |
realm.write(function _callee() { | |
return regeneratorRuntime.async(function _callee$(_context) { | |
while (1) { | |
switch (_context.prev = _context.next) { | |
case 0: | |
realm.create( | |
'Car', | |
{ | |
id: 1, | |
make: 'Honda', | |
model: 'Civic', | |
miles: 1000 | |
}, | |
true | |
); | |
_context.next = 3; | |
return regeneratorRuntime.awrap( | |
sleep(300) | |
); | |
case 3: | |
realm.create( | |
'Person', | |
{ | |
id: 1, | |
name: 'Charlie' | |
}, | |
true | |
); | |
case 4: | |
case 'end': return _context.stop(); | |
} | |
} | |
}, null, _this); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment