Closed kossnocorp closed 11 years ago
What require library are you using? RequireJS?
Nope, it just pure Node.js.
I dont really understand the use case for this. Can you explain precisely how you are intending to use DOM based keyboard events inside NodeJS?
@keithamus I'm using Node.js to run autotests in console. I'm emulate DOM via jsdom
library so I don't have to manually run tests in browser.
Aside from my urge to tell you that that is probably a bad idea, and you should consider using PhantomJS or a real browser via something like Selenium instead, I have to close this pull request because your code actually breaks in a real browser environment, as Uncaught ReferenceError: global is not defined
.
You would instead need a ternary like typeof global === 'undefined' ? this : global
Example of problem:
For code:
I've got: "TypeError: Expecting a function in instanceof check, but got [object Object]".
When I put console output to this code:
Output:
This happen because
this != global
in require:but