1.1.0 • Published 3 years ago
@dcl/es5-context v1.1.0
@dcl/es5-context
This library is a "good enough" effort to sandbox as much as possible the context of the WebWorkers.
With the objective of migrating to a future light weight runtime for the scene code, we must keep our environment as small as possible. That is the reason why we chose to stick to the ES5 standard for our scenes.
Usage
npm i -D @dcl/es5-context
import { createRealmRec, createNewUnsafeRec } from "@dcl/es5-context";
const rec = createRealmRec(createNewUnsafeRec(globalThis));
rec.safeGlobal.aaa = "test";
rec.safeGlobal.log = (msg) => {
console.log(msg);
return 1;
};
const result = rec.safeEval("log(`hi ${aaa}`)"); // prints "hi test"
// result == 1
rec.safeEval("console"); // undefined
rec.safeEval("Proxy"); // undefined
rec.safeEval("Promise"); // [Function: Promise]
Publishing
This repository is automatically published on merge to master by oddish
1.1.0
3 years ago
1.1.0-20210524000916.commit-b6081cf
3 years ago
1.1.0-20210523233740.commit-5a404f8
3 years ago