The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

dhurtt (9) [Avatar] Offline
I changed the code as indicated and it broke at:

window.document.getElementById('current-folder').innerText = folderPath;
TypeError: Cannot set property 'innerText' of null
at Object.updateCurrentFolder (/Users/dhurtt/Documents/Coding/lorikeet/userInterface.js:5:62)

When I jumped into the devtools I could run the following command and get the empty string:


But, if I ran the following command I got an error:

userInterface.updateCurrentFolder ('/Users/dhurtt')

Again, the error was:

TypeError: Cannot set property 'innerText' of null

I was able to get around the error by passing the window object from app.js to userInterface.js and then adding it as a parameter to the function definitions:

userInterface.updateCurrentFolder(fileSystem.getUsersHomeFolder(), window);


userInterface.addFileToMainArea(file, window);

Looking at your code didn't provide me a clue as it had changed so radically from the initial version. Any ideas why the initial code fails for me unless I specifically pass the window object? It almost seems like I don't have access to the "right" window object. (I tried experiments with Window.get() and it complained:

cannot get current window; are you in background page/node context?

Any insight would be appreciated, as would clarification in the book. As it stands, I am typing it straight out and it fails when I refactor. Is this also a change from 0.12.x to 0.13.x, like the toolbar issue I reported earlier?


Dale Hurtt
paulbjensen (39) [Avatar] Offline
Hi Dale,

Thanks for your message. Since writing that I've updated the chapter, so that issue should go away. Chapter 3's code is available here:

Once Chapter 3 is updated on MEAP you'll be able to follow with the code in the Github repo.


Paul Jensen