Iron Router 改变路由器状态

Iron Router changes router condition

我想 console.log 当路由器仅从 "home" 更改为 "aboutpage" 或任何其他页面时,但从主页。

我无法想出任何逻辑,所以没有尝试任何东西。

尝试这样的事情

Router.route('/', {
    name : 'home',
    template : 'home',
    title: 'Home'
});

Router.route('/about', {
    name : 'about',
    template : 'about',
    title: 'About'
});

Router.onStop(function(){
     Session.set("previousPath",Router.current().route.getName());
});

Router.onBeforeAction(function(){
    if(Session.get("previousPath")=="home"){
        console.log('something')
    }
    this.next()     
})