Monaca Onsen UI Discord Chat Github Repo

[SOLVED] Override Onsen UI v1 pushPage function

  • Hello,

    I would like to backport this bugfix to my v1 onsen ui apps :

    I don’t want to change the existing files, so I hoped I could somewhat redefine/override/overload the NavigatorView.pushPage function, but I can’t figure out how to do that… Any ideas ?

  • I solved my problem this way:

    // Onsen UI v1 dit not get this bugfix to prevent loading the page twice if user taps twice
    // so we backport it from
    angular.module('onsen').run(['NavigatorView', function(NavigatorView) {
        NavigatorView.prototype.pushPage = function(page, options) {
            if (this._profiling) {
            options = options || {};
            if (options.cancelIfRunning && this._isPushing) {
            if (options && typeof options != 'object') {
              throw new Error('options must be an object. You supplied ' + options);
            if (this._emitPrePushEvent()) {
            // the backport is just this line...
            this._isPushing = true;
            this._doorLock.waitUnlock(function() {
              this._pushPage(page, options);