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

jsdom: 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()

clearGlobal(): void

返回

void

定义于

index.d.ts:112


injectGlobals()

injectGlobals(): void

返回

void

定义于

index.d.ts:109


reset()

reset(): void

返回

void

定义于

index.d.ts:113


switchToBackgroundThread()

switchToBackgroundThread(): void

返回

void

定义于

index.d.ts:110


switchToMainThread()

switchToMainThread(): void

返回

void

定义于

index.d.ts:111

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。