Search code examples
javascriptsproutcore

Loading external data into a SproutCore app


I have a sample SproutCore app at https://github.com/ericgorr/myproject. The app is *sc_technique* inside of the project. This app is based upon the gist at https://gist.github.com/mauritslamers/5384031.

As best I understand the technique being described, the external data to be loaded is stored in the helper.js file. For example:

MyApp.statechart.sendEvent("loadData",[{ folder: "name": files: ["filename1.js"] }]);

It is then added to the document as a javascript script. The lines of the script are executed to generate events and the data is added to the app's SC.Store. After the script executes, it is removed.

When I attempt to implement this technique in my own app, I cannot get it to work. The error I am getting is:

Uncaught SyntaxError: Unexpected token : helper.js:1

It seems as if the app is trying to load the helper.js file before I tell it to do so. I get this error at the app first launches and before it executes the first line in main.js.

I know there are other problems in this app, but I cannot work on those until I can get past this problem.


Solution

  • as the browser is pointing out: there is a syntax error in the helper.js file:

    the colon after "name" should be a comma.