setItems added to ViewController

This commit is contained in:
Max Lynch
2015-06-20 12:54:18 -05:00
parent 2fdb4aeb29
commit 55e1817b0f
3 changed files with 39 additions and 11 deletions

View File

@ -417,6 +417,34 @@ export class ViewController {
return this.items.length;
}
/**
* Set the item stack to reflect the given component classes.
*/
setItems(components) {
// Pop all of the current items
this.clear();
// Then, change the root
let leavingItem = this.getActive() || new ViewItem();
leavingItem.shouldDestroy = true;
leavingItem.shouldCache = false;
leavingItem.willUnload();
this.transitionComplete();
for(let c of components) {
this.push(c, {
animate: false
})
}
}
/**
* Pops off all the trailing items, but leaves the root.
* To change the root, call setRoot with the root component.
*/
clear() {
let pops = [];
for (let item of this.items) {