Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Latest commit

 

History

History
30 lines (20 loc) · 676 Bytes

queries.md

File metadata and controls

30 lines (20 loc) · 676 Bytes

Finding modules

When working with a nested (DOM like) view structure, you need a way get to child view instances. FruitMachine has three APIs for this:

View#module();

Returns a single descendant View instance by module type. Similar to Element.prototype.querySelector.

apple.module('orange');
//=> orange

View#modules();

Returns a list of descendant View instance by module type. Similar to Element.prototype.querySelectorAll.

apple.modules('orange');
//=> [orange, orange, ...]

View#id();

Returns a single descendant View instance by id. Similar to document.getElementById.

apple.id('my_orange_1');
//=> orange