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()
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.