mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
@@ -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; });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user