下面是启动 MongoDB 领域文档中给出的应用程序的快速启动代码。
import Realm from 'realm';
let app;
// Returns the shared instance of the Realm app.
export function getRealmApp() {
if (app === undefined) {
const appId = 'demo'; // Set Realm app ID here.
const appConfig = {
id: appId,
timeout: 10000,
app: {
name: 'demo',
version: '0',
},
};
app = new Realm.App(appConfig);
}
return app;
}
当我调用该函数时,我总是得到:
空对象{}
领域版本:"^10.0.0-beta.12"