one
Version:
One is a React framework for web, iOS, and Android apps.
20 lines (17 loc) • 791 B
JavaScript
import { getSyncStateInstaller } from "./syncInstaller.native.js";
var GLOBAL_KEY = "__OneNativeSyncState";
function getNativeSyncFactory() {
var _ref;
var _getSyncStateInstaller;
var globals = globalThis;
var existing = globals[GLOBAL_KEY];
if (existing) return existing;
var installed = (_ref = (_getSyncStateInstaller = getSyncStateInstaller()) === null || _getSyncStateInstaller === void 0 ? void 0 : _getSyncStateInstaller.install()) !== null && _ref !== void 0 ? _ref : false;
var factory = installed ? globals[GLOBAL_KEY] : void 0;
if (!factory) {
throw new Error("useNativeState requires the OneNative native module (iOS or Android): the sync handle is native-owned.");
}
return factory;
}
export { getNativeSyncFactory };
//# sourceMappingURL=syncNative.native.js.map