lynx-testing-environment / LynxTestingEnv
类: LynxTestingEnv
A pure-JavaScript implementation of the Lynx Spec,
notably the Element PAPI and Dual-threaded Model for use with Node.js.
示例
import { LynxTestingEnv } from '@lynx-js/testing-environment';
const lynxTestingEnv = new LynxTestingEnv();
lynxTestingEnv.switchToMainThread();
// use the main thread Element PAPI
const page = __CreatePage('0', 0);
const view = __CreateView(0);
__AppendElement(page, view);
构造函数
new LynxTestingEnv()
new LynxTestingEnv(): LynxTestingEnv
返回
LynxTestingEnv
定义于
index.d.ts:108
属性
backgroundThread
backgroundThread: LynxGlobalThis;
The global object for the background thread.
示例
import { LynxTestingEnv } from '@lynx-js/testing-environment';
const lynxTestingEnv = new LynxTestingEnv();
lynxTestingEnv.switchToBackgroundThread();
// use the background thread global object
globalThis.lynxCoreInject.tt.OnLifecycleEvent(...args);
定义于
index.d.ts:88
jsdom
定义于
index.d.ts:107
mainThread
mainThread: LynxGlobalThis & ElementTreeGlobals;
The global object for the main thread.
示例
import { LynxTestingEnv } from '@lynx-js/testing-environment';
const lynxTestingEnv = new LynxTestingEnv();
lynxTestingEnv.switchToMainThread();
// use the main thread global object
const page = globalThis.__CreatePage('0', 0);
const view = globalThis.__CreateView(0);
globalThis.__AppendElement(page, view);
定义于
index.d.ts:106
方法
clearGlobal()
返回
void
定义于
index.d.ts:112
injectGlobals()
返回
void