azicchetti/jquerymobile-router

defaultHandler is not invoked when customer handlers are not specified

AlexBulankou opened this issue · 0 comments

If I configure my router like this (no specific handlers, but I would like defaultHandler to fire)

var router=new $.mobile.Router({            
        },{ 
        },{ 
          defaultHandler: function(type, ui, page) {
            console.log("Default handler called due to unknown route (" 
              + type + ", " + ui + ", " + page + ")"
            );
          },
          defaultHandlerEvents: "bc,c,i,bs,s,bh,h",
      defaultArgsRe: true
        });

defaultHandler is not invoked.
But it is invoked when I specify at least one route:

var router=new $.mobile.Router({   
              "#index": { handler: function(type){
            console.log("Index has been "+(type=="pagehide"?"hidden":"shown"));
          }, events: "h,s" }    
        },{
        },{ 
          defaultHandler: function(type, ui, page) {
            console.log("Default handler called due to unknown route (" 
              + type + ", " + ui + ", " + page + ")"
            );
          },
          defaultHandlerEvents: "bc,c,i,bs,s,bh,h",
      defaultArgsRe: true
        });

Expected: defaultHandler to be invoked even without specific routes specified. I read through the introduction page, don't think this is intended behavior.