Skip to content

Instantly share code, notes, and snippets.

@botmaster
Forked from falkolab/findViews.js
Created October 30, 2015 12:23
Show Gist options
  • Save botmaster/3b5bd55c22869e8e0110 to your computer and use it in GitHub Desktop.
Save botmaster/3b5bd55c22869e8e0110 to your computer and use it in GitHub Desktop.
Find views in view hierarchy that corresponded specified properties. Titanium Alloy.
var findViews = function(where, props, deep) {
var ctl = _.where(where.children, props);
if(deep){
return _.reduce(where.children, function(memo, view) {
return memo.concat(findViews(view, props, true));
}, ctl);
} else {
return ctl;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment