Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

Commit

Permalink
Filter promises for .woven. Closes #14
Browse files Browse the repository at this point in the history
Complete new weave implementation. Closes #13
  • Loading branch information
mikaelkaron committed Feb 21, 2013
1 parent d4e899c commit 0d80db4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/weave.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,13 @@ define([ "require", "jquery", "when", "troopjs-utils/getargs", "troopjs-utils/fi

// Iterate
$(this).each(function (index, element) {
// Add promise of widgets to woven
woven[wovenLength++] = when.all($.data(element, WIDGETS), function (widgets) {
// Filter widgets using re
return widgets.filter(function (widget) {
return re.test(widget.displayName);
});
// Filter widget promises
var $widgets = ($.data(element, WIDGETS) || []).filter(function ($widget) {
return re.test($widget[WEAVE]);
});

// Add promise of widgets to woven
woven[wovenLength++] = when.all($widgets);
});
}
// Otherwise we can use a faster approach
Expand Down

0 comments on commit 0d80db4

Please # to comment.