返回博主主页
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 30 下一页
摘要: reference:https://blog.csdn.net/weixin_41427129/article/details/113561980 一、概述 本文主要讲解的是 CGLIB 的常用 API 及其使用方式。使用的 CGLIB 依赖如下所示: <dependency> <groupId>c 阅读全文
posted @ 2021-11-02 10:06 懒惰的星期六 阅读(209) 评论(0) 推荐(0)
摘要: 实例:Web 服务的客户端 Proxy 对象可以拦截目标对象的任意属性,这使得它很合适用来写 Web 服务的客户端。 const service = createWebService('http://example.com/data'); service.employees().then(json 阅读全文
posted @ 2021-11-01 20:48 懒惰的星期六 阅读(218) 评论(0) 推荐(0)
摘要: 虽然 Proxy 可以代理针对目标对象的访问,但它不是目标对象的透明代理,即不做任何拦截的情况下,也无法保证与目标对象 的行为一致。主要原因就是在 Proxy 代理的情况下,目标对象内部的 this 关键字会指向 Proxy 代理。 const target = { m: function() { 阅读全文
posted @ 2021-11-01 20:34 懒惰的星期六 阅读(465) 评论(0) 推荐(0)
摘要: 利用 Proxy,可以将读取属性的操作( get ),转变为执行某个函数,从而实现属性的链式操作。 var pipe = (function() { return function(value) { // console.log(value) // 4 var funcStack = []; var 阅读全文
posted @ 2021-11-01 20:03 懒惰的星期六 阅读(260) 评论(0) 推荐(0)
摘要: 参考书籍链接:https://es6.ruanyifeng.com/#docs/generator-async 1.Symbol.hasInstance 对象的 Symbol.hasInstance 属性,指向一个内部方法。当其他对象使用 instanceof 运算符,判断是否为该对象的实例时,会调 阅读全文
posted @ 2021-11-01 11:52 懒惰的星期六 阅读(164) 评论(0) 推荐(0)
摘要: 1. // function* demo() { // foo(yield 'a', yield 'b'); // OK // let input = yield; // OK // } function* demo() { // console.log('Hello' + yield); // S 阅读全文
posted @ 2021-11-01 10:11 懒惰的星期六 阅读(74) 评论(0) 推荐(0)
摘要: 结论先行: yield 句本身没有返回值,或者说总是返回 undefined 。 next 方法可以带一个参数,该参数就会被当作上一个 yield 语句的返回 值。 1. next()不带参数 function* gen(x) { for (var x of [1,2,3,4,5]){ var y 阅读全文
posted @ 2021-10-29 20:51 懒惰的星期六 阅读(144) 评论(0) 推荐(0)
摘要: 1. 生产环境的转换器,建议使用 Thunkify 模块。 // "use strict" function thunkifyy(fn) { return function() { console.log(arguments); //Arguments(2) [8, 9, callee: ƒ, Sy 阅读全文
posted @ 2021-10-29 17:56 懒惰的星期六 阅读(107) 评论(0) 推荐(0)
摘要: 1. JavaScript 语言的 Thunk 函数 JavaScript 语言是传值调用,它的 Thunk 函数含义有所不同。在 JavaScript 语言中,Thunk 函数替换的不是表达式,而是 多参数函数,将其替换成一个只接受回调函数作为参数的单参数函数。 // ES6版本 var Thun 阅读全文
posted @ 2021-10-29 16:39 懒惰的星期六 阅读(139) 评论(0) 推荐(0)
摘要: 1. console.log("ddd") var data = []; for(var i = 0 ; i < 3; i++){ data[i]=function() { console.log(i); } } data[0]();// 3 data[1]();// 3 data[2]();// 阅读全文
posted @ 2021-10-29 11:06 懒惰的星期六 阅读(49) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 30 下一页