For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/lynx-testing-environment/Class.LynxTestingEnv.md.
Lynx
  • English
  • 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.

    Example

    import { LynxTestingEnv } from '@lynx-js/testing-environment';
    import { JSDOM } from 'jsdom';
    
    const lynxTestingEnv = new LynxTestingEnv({ window: new JSDOM().window });
    
    lynxTestingEnv.switchToMainThread();
    // use the main thread Element PAPI
    const page = __CreatePage('0', 0);
    const view = __CreateView(0);
    __AppendElement(page, view);
    

    Constructors

    new LynxTestingEnv()

    new LynxTestingEnv(env?: LynxEnv): LynxTestingEnv

    Parameters

    ParameterType
    env?LynxEnv

    Returns

    LynxTestingEnv

    Defined in

    index.d.ts:166

    Properties

    backgroundThread

    backgroundThread: LynxGlobalThis;

    The global object for the background thread.

    Example

    import { LynxTestingEnv } from '@lynx-js/testing-environment';
    import { JSDOM } from 'jsdom';
    
    const lynxTestingEnv = new LynxTestingEnv({ window: new JSDOM().window });
    
    lynxTestingEnv.switchToBackgroundThread();
    // use the background thread global object
    globalThis.lynxCoreInject.tt.OnLifecycleEvent(...args);

    Defined in

    index.d.ts:145


    env

    env: LynxEnv;

    Defined in

    index.d.ts:165


    mainThread

    mainThread: LynxGlobalThis & ElementTreeGlobals;

    The global object for the main thread.

    Example

    import { LynxTestingEnv } from '@lynx-js/testing-environment';
    import { JSDOM } from 'jsdom';
    
    const lynxTestingEnv = new LynxTestingEnv({ window: new JSDOM().window });
    
    lynxTestingEnv.switchToMainThread();
    // use the main thread global object
    const page = globalThis.__CreatePage('0', 0);
    const view = globalThis.__CreateView(0);
    globalThis.__AppendElement(page, view);

    Defined in

    index.d.ts:164

    Methods

    clearGlobal()

    clearGlobal(): void

    Returns

    void

    Defined in

    index.d.ts:170


    injectGlobals()

    injectGlobals(): void

    Returns

    void

    Defined in

    index.d.ts:167


    reset()

    reset(): void

    Returns

    void

    Defined in

    index.d.ts:171


    switchToBackgroundThread()

    switchToBackgroundThread(): void

    Returns

    void

    Defined in

    index.d.ts:168


    switchToMainThread()

    switchToMainThread(): void

    Returns

    void

    Defined in

    index.d.ts:169

    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.