extjs mvc controller 监听浏览器关闭或者页面刷新

    init:function(){
        this.control({
             'RevisionFormNew':{
             	'show':function(view){
             		//监听浏览器关闭事件,如果窗口关闭或者页面刷新,删除草稿
             	    Ext.EventManager.on(window, 'beforeunload', function() {
		          	    Ext.Ajax.request({
					        	url:context+ 'api/revision/'+view.rid,
						    	method:'delete',
						    	async:false,
						    	success:function(response, opts){
						    		
						        }
			            })
					});
             	}
             }
        })
    }


你可能感兴趣的:(ext)