Merge pull request from tmickel/feature/2.0-loader

Start of a 2.0 project loader
This commit is contained in:
Tim Mickel 2016-09-02 11:16:35 -04:00 committed by GitHub
commit 86f136dd10
14 changed files with 2058 additions and 93 deletions
src/engine

View file

@ -18,9 +18,8 @@ var defaultBlockPackages = {
/**
* Manages targets, scripts, and the sequencer.
* @param {!Array.<Target>} targets List of targets for this runtime.
*/
function Runtime (targets) {
function Runtime () {
// Bind event emitter
EventEmitter.call(this);
@ -28,8 +27,9 @@ function Runtime (targets) {
/**
* Target management and storage.
* @type {Array.<!Target>}
*/
this.targets = targets;
this.targets = [];
/**
* A list of threads that are currently running in the VM.
@ -418,6 +418,20 @@ Runtime.prototype.targetForThread = function (thread) {
}
};
/**
* Get a target by its id.
* @param {string} targetId Id of target to find.
* @return {?Target} The target, if found.
*/
Runtime.prototype.getTargetById = function (targetId) {
for (var i = 0; i < this.targets.length; i++) {
var target = this.targets[i];
if (target.id == targetId) {
return target;
}
}
};
/**
* Handle an animation frame from the main thread.
*/