rstacruz/jsdom-global

FileReader not working

makua-bernal opened this issue · 3 comments

fileReader = new FileReader() doesn't appear to be working, although new File() works, is this intended? It appears to be implemented in jsdom according to the version 7 changelog.

i setup a fork here:

https://github.com/modosc/global-jsdom

it reads all the dom keys in directly from the jsdom object so as long as you're using a recent enough version of jsdom this will work:

> $ node
> new FileReader()
ReferenceError: FileReader is not defined
    at repl:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at REPLServer.defaultEval (repl.js:239:29)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:440:10)
    at emitOne (events.js:120:20)
    at REPLServer.emit (events.js:210:7)
    at REPLServer.Interface._onLine (readline.js:282:10)
    at REPLServer.Interface._line (readline.js:631:8)
> require('global-jsdom')()
[Function: cleanup]
> new FileReader()
FileReader {}

@modosc Could you submit this as a PR rather than forking it? Is jsdom-global not being maintained anymore?

this repo appears abandoned - it's been almost a year since any code activity. if you want to make a pr out of those changes feel free to.