Home > @lynx-js/test-environment > LynxEnv

LynxEnv class

A pure-JavaScript implementation of the Lynx Spec, notably the Element PAPI and Dual-threaded Model for use with Node.js.

Signature:

export declare class LynxEnv

Example

import { LynxEnv } from '@lynx-js/test-environment';

const lynxEnv = new LynxEnv();

lynxEnv.switchToMainThread();
// use the main thread Element PAPI
const page = __CreatePage('0', 0);
const view = __CreateView(0);
__AppendElement(page, view);

Constructors

Constructor Modifiers Description
(constructor)() Constructs a new instance of the LynxEnv class

Properties

Property Modifiers Type Description
backgroundThread LynxGlobalThis The global object for the background thread.
jsdom JSDOM
mainThread LynxGlobalThis & ElementTreeGlobals The global object for the main thread.

Methods

Method Modifiers Description
clearGlobal()
injectGlobals()
resetLynxEnv()
switchToBackgroundThread()
switchToMainThread()
除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。