@nozbe/watermelondb
Version:
Build powerful React Native and React web apps that scale from hundreds to tens of thousands of records and remain fast
17 lines (15 loc) • 482 B
JavaScript
;
exports.__esModule = true;
exports.default = nativeRandomId_v2;
var _reactNative = require("react-native");
var randomIds = [];
var cur = 9999;
// NOTE: This is 2x faster thn Math.random on iOS (6x faster than _v1)
// Should be ported to Java too… or better yet, implemented in JSI
function nativeRandomId_v2() {
if (64 <= cur) {
randomIds = _reactNative.NativeModules.WMDatabaseBridge.getRandomIds().split(',');
cur = 0;
}
return randomIds[cur++];
}