javascript - goog.provide() - Uncaught SyntaxError: Unexpected token ILLEGAL -


so decided today play around limejs bit, i've never used closure before new me well. i've run small problem right off bat , not sure wrong.

so far project 3 files: firstgame.html, firstgame.js, `player.js

firstgame.html:

<!doctype html>  <html> <head>     <title>firstgame</title>     <script type="text/javascript" src="../closure/closure/goog/base.js"></script>     <script type="text/javascript" src="firstgame.js"></script>     <script type="text/javascript" src="player.js"></script> </head>  <body onload="firstgame.start()"></body>  </html> 

firstgame.js:

goog.provide('firstgame');   //get requirements goog.require('lime.director'); goog.require('lime.scene'); goog.require('lime.layer'); goog.require('lime.circle'); goog.require('lime.label'); goog.require("lime.sprite"); goog.require('lime.animation.spawn'); goog.require('lime.animation.fadeto'); goog.require('lime.animation.scaleto'); goog.require('lime.animation.moveto'); goog.require("firstgame.player");   // entrypoint firstgame.start = function(){      var director = new lime.director(document.body,1024,768);     director.makemobilewebappcapable();     scene = new lime.scene();     var background = new lime.sprite().setsize(1524,768).setposition(0,0).setfill(0,0,0).setanchorpoint(0,0);     var player = new firstgame.player();     scene.appendchild(background);     // set current scene active     director.replacescene(scene);  }   //this required outside access after code compiled in advanced_compilations mode goog.exportsymbol('firstgame.start', firstgame.start); 

and player.js(the idea custom ui component inherit sprite):

goog.provide("firstgame.player');   goog.require('lime.sprite');  // new constructor firstgame.player = function(){     // call parents constructor     goog.base(this);      // custom initialization code     this.color_ = 'red'; } // define parent class goog.inherits(firstgame.player,lime.sprite); 

i ran lime.py update (not sure if needed because adding class , not whole new namespace figured should safe)

when load page unexpected token error noted above, happens on line 1 of player.js, goog.provide(). if remove player.js script path in html file find other code runs ok suggests linking closure library expected. it's when try use in player.js run problem. first inclination maybe code executing before closure library parsed, looked hook tie when closure loaded couldn't find anything. i've googled around , haven't found answer. feel missing simple can't quite it. if had advice appreciate it, much!

goog.provide("firstgame.player'); 

should be

goog.provide('firstgame.player'); 

your qoutes don't match.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -