Open dy opened 2 years ago
I had the same problem.But I use const sandbox = Realm.makeRootRealm(); // root realm
, and it worked.
import Realm from "https://cdn.jsdelivr.net/npm/realms-shim@1.2.2/dist/realms-shim.esm.min.js";
console.log(Realm);
const sandbox = Realm.makeRootRealm(); // root realm
const unsafeCode = "function main(){return 1000};main();";
let result;
try {
result = sandbox.evaluate(unsafeCode);
} catch (e) {
result = `Error: ${e}`;
}
console.log(result);
Using latest
realms-shim.min.js
in code as:Getting
But if calling it as constructor
realm = new Realm()
, getting:I'm confused. I guess will try partytown for now.