Skip to content

Instantly share code, notes, and snippets.

@ttdonovan
Created October 22, 2008 16:05
Show Gist options
  • Select an option

  • Save ttdonovan/18676 to your computer and use it in GitHub Desktop.

Select an option

Save ttdonovan/18676 to your computer and use it in GitHub Desktop.
_buildOutlets: function (children) {
var retOutlets = []; // array of outlet objects
children.each(function(child) {
retOutlets.push(this._buildOutlet(child));
}, this); // TODO: look into which is best {}, this or {}.bind(this)
return retOutlets;
},
_buildOutlet: function (child) {
var domID = this._viewID(child.guid), // guid id for outlet
params = {}, // params for outlet SC.View.extend()
html = null, // html string of empty outlet element
outletFor = null, // outletFor function
outletIDs = [], // outlet key ids
outlets = null, // // outlets' outlets, children of child
retOutlet = {}; // empty outlet object
// TODO: make this a seperate function _outletParams() return params
if (child.children) {
outlets = this._buildOutlets(child.children); // if child has children build outlets
outlets.each(function (o) { // add each outlet of params
params[o.domID] = o.outletFor;
outletIDs.push(o.domID); // track outlet key ids
});
params['outlets'] = outletIDs; // add outlet keys to param 'outlets'
}
// code to defined outlet object { domID: '', outletFor: function() }
return retOutlet;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment