Skip to content

Instantly share code, notes, and snippets.

@falkolab
Created September 2, 2014 13:57
Show Gist options
  • Save falkolab/ce8c8678b5ba1ed68427 to your computer and use it in GitHub Desktop.
Save falkolab/ce8c8678b5ba1ed68427 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;
}
};
@arifje
Copy link

arifje commented Aug 24, 2016

do you have a small usage example for this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment