随笔分类 - JS设计模式
摘要:http://www.ruanyifeng.com/blog/2013/09/finite-state_machine_for_javascript.html
阅读全文
摘要:Function.prototype.before = function( beforefn ){ var __self = this; // 保存原函数的引用 return function(){ // 返回包含了原函数和新函数的"代理"函数 beforefn.apply( this, argum
阅读全文
摘要:<button id="button">按我</button> <script> var MacroCommand = function () { return { commandsList: [], add: function (command) { console.log(command); t
阅读全文
摘要:var button1 = document.getElementById("button1"); var button2 = document.getElementById("button2"); var button3 = document.getElementById("button3");
阅读全文
摘要:实战经常用的 先创建一个用于求乘积的函数: var mult = function(){ console.log( '开始计算乘积' ); var a = 1; for ( var i = 0, l = arguments.length; i < l; i++ ){ a = a * argument
阅读全文
摘要:https://segmentfault.com/a/1190000017721211 // 在这里写 var strategies = { isNonEmpty(value, errorMsg) { if (value "") { return errorMsg; } }, minLength(v
阅读全文
摘要:https://zhuanlan.zhihu.com/p/75129004?from_voters_page=true
阅读全文
摘要:https://www.cnblogs.com/chen-jie/p/JavaScript-Entrust.html
阅读全文
摘要:https://blog.csdn.net/KlausLily/article/details/103046377 const baseOperateController = function() { // 缓存对象 const cache = {}; // 基础函数 return function
阅读全文
摘要:https://www.cnblogs.com/tugenhua0707/p/4780227.html
阅读全文
摘要:https://www.cnblogs.com/TomXu/archive/2012/04/16/2436460.html
阅读全文
摘要:https://www.jianshu.com/p/11918dd0f694
阅读全文
摘要:http://www.manongjc.com/article/42740.html // //书籍建造者类 // class BookBuilder { // constructor() { // this.name = ""; // this.author = ""; // this.price
阅读全文
摘要:const optionsAdded = {}; eventsListened.forEach(elt => { optionsAdded["on" + elt] = delegateAndEmit.call(this, elt); }); const eventsListened = ["Star
阅读全文
摘要:function mergeHook ( parentVal, childVal ) { var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [child
阅读全文
摘要:进阶函数柯里化 ...args这是柯里化,给fn传参的
阅读全文

浙公网安备 33010602011771号