Skip to content

Commit

Permalink
fix bug where load from config was not being used
Browse files Browse the repository at this point in the history
  • Loading branch information
neonstalwart committed Aug 18, 2011
1 parent 3c533d0 commit 59ea8f5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Twine.js
Expand Up @@ -109,7 +109,7 @@ define([
if (fibers && fibers.length) {
// configure the fibers and add to the sequence of promises
seq.push(function () {
return when(container._configureFibers(fibers), function (fibers) {
return when(container._configureFibers(fibers, load), function (fibers) {
// add each fiber to this container
return all(arr.map(fibers, function (fiber) {
return container.addFiber(fiber);
Expand All @@ -122,7 +122,7 @@ define([
if (installers && installers.length) {
// configure the installers and add them to the sequence of promises
seq.push(function () {
return when(container._configureInstallers(installers),
return when(container._configureInstallers(installers, load),
function (installers) {
// install each of the installers
return all(arr.map(installers, function (installer) {
Expand Down Expand Up @@ -161,8 +161,9 @@ define([
// - a string, considered as a module id to be loaded and then considered again
// - a function, it will be considered a factory and executed
// - anything else, assumed to be an instance of a fiber
_configureFibers: function (fibers) {
_configureFibers: function (fibers, load) {
fibers = fibers || [];
load = load || this.load;

var dfd = defer(),
deps = [],
Expand All @@ -177,7 +178,7 @@ define([
// if any dependencies need to be loaded
if (deps.length) {
// load the modules and then resolve the deferred
this.load(deps, function () {
load(deps, function () {
// NOTE: this changes the order compared to the config
dfd.resolve(normalizeConfigItems(loaded.concat(slice.call(arguments))));
});
Expand All @@ -190,8 +191,9 @@ define([
},

// installers can be provided in the same way as fibers
_configureInstallers: function (installers) {
_configureInstallers: function (installers, load) {
installers = installers || [];
load = load || this.load;

var dfd = defer(),
deps = [],
Expand All @@ -206,7 +208,7 @@ define([
// if any dependencies need to be loaded
if (deps.length) {
// load the modules and then resolve the deferred
this.load(deps, function () {
load(deps, function () {
dfd.resolve(normalizeConfigItems(loaded.concat(slice.call(arguments))));
});
}
Expand Down

0 comments on commit 59ea8f5

Please sign in to comment.