feat(tabs): ref parent nav controllers

Closes #621
This commit is contained in:
Adam Bradley
2015-11-22 23:10:23 -06:00
parent 68ee8065c8
commit 4e01ec09a2
4 changed files with 66 additions and 43 deletions

View File

@@ -148,12 +148,21 @@ export class NavController extends Ion {
*/
push(componentType, params = {}, opts = {}) {
if (!componentType) {
console.debug('invalid componentType to push');
return Promise.reject();
}
if (typeof componentType !== 'function') {
throw 'Loading component must be a component class, not "' + componentType.toString() + '"';
}
let now = Date.now();
let last = this.last();
if (last && last.componentType === componentType && now + 500 > this._lastPush) {
console.debug('same componentType pushed as active');
return Promise.reject();
}
this._lastPush = now;
let resolve;
let promise = new Promise(res => { resolve = res; });