Skip to content

Modifying globals (client-side javascript) #55

@u8sand

Description

@u8sand

Is there any way to modify globals as a workaround for supporting client javascript libraries (in particular) and overcoming the following error:

const jsdom = require('jsdom')
const dom = new jsdom.JSDOM()
window = dom.window
const gapi = require('gapi-client')
ReferenceError: window is not defined
    at Object.<anonymous> (jupyter-nodejs/node_modules/gapi-client/index.js:1:72)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at jupyter-nodejs/build/context.js:69:18
    at require (jupyter-nodejs/build/context.js:58:27)

Even though I've 'defined' window, I still receive ReferenceError: window is not defined. This is perhaps because we're stuck in a closure? I was under the impression javascript modified globals by default, I may just not fully understand node-js behavior. Is there a way we could support something like this or a better way to execute client-side libraries in jupyter-nodejs?

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