playcanvas/engine — pull request #43 by demalus (2014-10-01 20:39:43+00:00)
Title: Feature/combined script files

This branch allows you to have multiple pc.script.create calls in a single file and each script will be pulled out and put on an entity correctly. It passes the test cases currently in master and I added a new test case. It should maintain backward compatibility as well.

Here's a few things to note:
1. You should now make sure to specify a script with both the url and the name. Ex: e.script.scripts = [{name: "somename", url: "somefile.js"}]
2. When a script is loaded onto the document and passed back to _loadScripts / _loadFromCache, the pair is checked for each loaded pc.script instead of just the url UNLESS the names are unspecified - then it just checks the url. If using the PlayCanvas designer, the name field should always be there, but if someone is putting scripts together manually, they should continue to work with this patch.

This patch is in reference to my question: http://answers.playcanvas.com/questions/694/multiple-scripts-in-the-same-file