text: /*! wangkuan - 2015-11-28 09:23:38 */
  define(function(require,exports,module){"use strict";var $=require("$"),common=require("../common/common"),Router=function(){this._version=1,this._start=!1};return Router.prototype={config:function(config){return this.config=config,this},controller:function(controller){return this.controller=controller,this},render:function(config){var url=config.templateUrl(common.getParams(location.href)),container=$(config.container);common.getHtml(url).then(function(html){container.html(html),config.controller&&("function"==typeof config.controller?config.controller():"string"==typeof config.controller&&this.controller[config.controller]())}.bind(this))},watch:function(){var url=common.getUrl()||"index",config=this.config.hasOwnProperty(url)?this.config[url]:this.config.index;this.render(config)},start:function(){if(this._start)throw new Error("Router had started!");return this._start=!0,window.onhashchange=function(){this.watch()}.bind(this),this.watch(),this},stop:function(){this._start=!1,window.onhashchange=null}},Router});