Fetch the repository succeeded.
A implementation of the ShadowRealm API Proposal, a JavaScript sandbox, test with TC39 Test262 cases.
简体中文 | English
declare class ShadowRealm {
constructor();
evaluate(sourceText: string): Primitive | Function;
importValue(specifier: string, bindingName: string): Promise<Primitive | Function>;
}
npm i -S shadowrealm-api
import ShadowRealm from 'shadowrealm-api'
const realm = new ShadowRealm();
import 'shadowrealm-api/dist/polyfill'
const realm = new ShadowRealm();
Print internal info for debugging
ShadowRealm.__debug = true;
// ❌
import/* */defaultExport from "module-name";
export default/* */'xxx';
// ✅
import defaultExport from "module-name";
export default 'xxx';
// ❌
export const obj = {...}, fn = () => {...};
// ✅
const obj = {...}, fn = () => {...};
export { obj, fn };
IE | Edge | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|---|
14 | 29[1][2] | 32[1][2] | 8[2][3] | 19[1][2] | |
41 | 49 | 10.1[3] | 36 | ||
14.1 |
Notes:
- Don't support destructuring assignment in ESM statement;
- Need
fetch
polyfill in top window;- Need
URL
polyfill in top window;
Use polyfills:
import "fetch polyfill";
import "URL polyfill";
import "shadowrealm-api/dist/polyfill";
// Your codes
Sign in to post a comment
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.
Repository Comments ( 0 )