tvOS Apprentice Ch. 2 JS Error

There appears to be a bug in Ch. 2. I have entered the code as instructed for main.js, and it throws can error in Safari. Ot says I’m missing a semi-colon, but they appear to all be there:

My Code:
App.onLaunch = function(options) {
var resourceLoader = new ResourceLoaderJS(nativeResourceLoader.create());
var initialDoc = resourceLoader.getDocument(“hello.tvml”);
navigationDocument.pushDocument(initialDoc);
}

class ResourceLoaderJS {
constructor(nativeResourceLoader) {
this.nativeResourceLoader = nativeResourceLoader;
this.domParser = new DOMParser();
}

getDocument(name) {
    var docString = this nativeResourceLoader.loadBundleResource(name);
    return this.domParser.parseFromString(docString, "application/xml");
}

}

Safari Error:
SyntaxError: Unexpected identifier ‘nativeResourceLoader’. Expected ‘;’ after variable declaration.

@wbalthrop Do you still have issues with this?

No, I can’t remember what I did to fix it, but I have been able to move on.

Thanks,

This topic was automatically closed after 166 days. New replies are no longer allowed.