标签:style blog color io ar for sp div c
var once = (function(){ var res = {}, i = 0 ; return function(func){ if(typeof(func) != ‘function‘){ alert(‘参数类型不正确‘); return false; } for(var j in res){ if( res[j].fn === func ){ console.dir(‘read from cache...‘); return res[j].ret; } } return res[i++] = {ret:func(),fn:func}; } })(); var a1 = function(){ return 1;} var a2 = function(){ return 2;} once(function(){ return 1; });
标签:style blog color io ar for sp div c
原文地址:http://www.cnblogs.com/glory-jzx/p/4004678.html