Trouble detecting libraries

41 views
Skip to first unread message

Sebastián Vansteenkiste

unread,
Oct 8, 2013, 2:37:46 PM10/8/13
to script...@googlegroups.com
Hi, first of all I'm really sorry if this has been asked before, but my searches proved futile.

I'm developing an html5 game with a library known as cocos2d-html5: https://github.com/cocos2d/cocos2d-html5/

I've tried many (MANY) javascript editors and, so far, Scripted does the most out of them to my liking, inferring/guessing the library's structure from the code in my own files, but I can't get it to recognize the classes in the library so I can get some degree of code-assistance. The main class in this library is called "cc". Of course, adding "cc" as a global definition for jshint eases the pain of having a miriad "cc is not defined" errors, but if I could get some real code assistance, that'd be great.


Andrew Eisenberg

unread,
Oct 9, 2013, 1:05:56 PM10/9/13
to Sebastián Vansteenkiste, script...@googlegroups.com
Scripted relies on a module system to determine where to find
dependencies. It can use AMD modules (eg- requirejs) or commonjs
modules (eg- node). There is some support for global modules (ie- no
module system and all files are in the same namespace). But, all
three of these systems require some sort of baseline from which to
determine dependencies between modules.

Since you are writing client side code, and it doesn't look like you
are using requirejs or AMD. Then your nest bet would be to create a
mock html file that imports all scripts that depend on each other
using script tags in the html file. Note that order is important
here. Files imported later in the html can reference files iimported
earlier, but not the other way around.

We wanted to allow a way to specify this in a config file, but never
got around to implementing this.
> --
> You received this message because you are subscribed to the Google Groups
> "scripted-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scripted-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Sebastián Vansteenkiste

unread,
Oct 10, 2013, 2:00:41 PM10/10/13
to Andrew Eisenberg, scripted-dev
I see.

The library I'm using is itself commented with JSDoc and has it's own (strange?) way of accessing to it's classes and functions in development, 'tho I guess they make more sense when you compile it all to a single file with google closure.

Anyway, thanks! I'll try and mock my way using a -big- pile of sript tags.

PS: the library does come with some build.xml files that list all the required files (i.e.: https://github.com/cocos2d/cocos2d-html5/blob/develop/cocos2d/build.xml ), do you think there's a way I could easily use that to tell scripted the dependencies?


  Sebastián Raúl Vansteenkiste


2013/10/9 Andrew Eisenberg <andrew.e...@gmail.com>

Sebastián Vansteenkiste

unread,
Oct 10, 2013, 3:27:38 PM10/10/13
to Andrew Eisenberg, scripted-dev
Well, I tried and adding the script tags didn't help.

Note: no, I didn't make it manually, I noticed that when the "index.html" file of a cocos2d project is opened, script tags are dynamically generated for each .js file of the library, so I just copied those over in hopes that they'd get recognized, but didn't.


  Sebastián Raúl Vansteenkiste


2013/10/10 Sebastián Vansteenkiste <sebav...@gmail.com>
Reply all
Reply to author
Forward
0 new messages