/** * 简易路由 */ var Router = { // 路由初始 init: function () { this.routes = {}; this.useRouter(); }, // 路由配置 route: function (path, cb) { this.routes[path] ... Read More
posted @ 2016-06-23 16:07 koala_熊 Views(322) Comments(0) Diggs(0) Edit
// 模拟原生JS中的bind, 将函数指针以值的形式传递,该函数必须在特定环境中执行 function bind(fn, context) { var args = Array.prototype.slice.call(arguments, 2); return function () { var innerArgs = Array.prototype.slic... Read More
posted @ 2016-06-23 15:11 koala_熊 Views(170) Comments(0) Diggs(0) Edit