Skip to content

Reference error: window is not defined #30

Description

@grrrwaaa

I created a new Node.js project and inserted the example code as per README:

import {BridgeClient} from '@lookingglass/bridge'

const Bridge = BridgeClient.getInstance()

async function run() {
    await Bridge.connect()
    console.log("ok")
}
run()

Result:

ReferenceError: window is not defined
    at ct (C:\Users\alice\Documents\anode_lookingglass\node_modules\@lookingglass\bridge\dist\looking-glass-bridge.js:1:2962)
    at dt.connectToBridgeEventSource (C:\Users\alice\Documents\anode_lookingglass\node_modules\@lookingglass\bridge\dist\looking-glass-bridge.js:1:4627)
    at T.subscribeToEvents (C:\Users\alice\Documents\anode_lookingglass\node_modules\@lookingglass\bridge\dist\looking-glass-bridge.js:1:80823)
    at T.connect (C:\Users\alice\Documents\anode_lookingglass\node_modules\@lookingglass\bridge\dist\looking-glass-bridge.js:1:71163) 
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (file:///C:/Users/alice/Documents/anode_lookingglass/test.mjs:12:5)

Node.js v20.18.0

Is this module only designed to work in a browser context?

I have another Node.js project that generates OpenGL scenes directly and want to view them on the Looking Glass. I am able to create a fullscreen undecorated window in my Node.js script and I can see this on the Looking Glass. I assumed that I needed to use Bridge to get the appropriate calibration data for the shaders to create the quilt. Is this possible via the '@lookingglass/bridge' node module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions