当前位置:网站首页>proxy 的不完整polyfill
proxy 的不完整polyfill
2020-11-09 23:48:00 【阿豪boy】
https://github.com/GoogleChrome/proxy-polyfill
只能针对已有的属性监听
The polyfill supports just a limited number of proxy 'traps'. It also works by calling seal on the object passed to
Proxy
. This means that the properties you want to proxy must be known at creation time.
const proxyPolyfill = require('proxy-polyfill/src/proxy')();
// Your environment may also support transparent rewriting of commonJS to ES6:
// import ProxyPolyfillBuilder from 'proxy-polyfill/src/proxy';
// const proxyPolyfill = ProxyPolyfillBuilder();
const target = {
message1: "hello",
message2: "everyone"
};
const handler2 = {
get: function(target, prop, receiver) {
return "world";
}
};
console.log(proxyPolyfill)
const proxy2 = new proxyPolyfill(target, handler2);
console.log(proxy2.message1,proxy2.message)
// [Function: ProxyPolyfill] { revocable: [Function (anonymous)] }
// world undefined
版权声明
本文为[阿豪boy]所创,转载请带上原文链接,感谢
https://my.oschina.net/ahaoboy/blog/4710395
边栏推荐
猜你喜欢
技术点5:XML语言
crm系统的成本一般是多少?
那么当下的行情投资者该怎么办呢? 现在新的投资风口来了!
Software engineering in code -- source code analysis of menu project
Function calculation advanced IP query tool development
如何高效进行模幂运算
How to greatly improve the performance of larravel framework under php7? Install stone!
Day84: Luffy: preferential activity strategy & User Authentication & checking / settlement of shopping cart goods
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
How to implement LRU algorithm
随机推荐
剑指offer之打印超过数组一半的数字
Nodejs: handwritten koa Middleware
【CentOS7操作系统安全加固系列】第(2)篇
Postman(一)---功能介绍
Dongge ate grapes when he ate an algorithm problem!
The basic principle of MRAM
快来学习!个性化推荐系统开发指南(附网盘链接)
How to carry out modular power operation efficiently
Baishan cloud technology is selected as the top 100 Internet enterprises in China in 2020
CRM系统能帮助企业做哪些事?
IP地址SSL证书
C/C++编程笔记:C语言开发坦克大战!纪念我们逝去的小霸王游戏
ES6, ES7, es8 Learning Guide
Kubernetes-18: installation and use of dashboard
Application of V7 version of lvgl Library
CUDA_全局内存及访问优化
On the practical application of C 9's new features
sql 截取数据中 ‘.’的前后数据
CUDA常用概念及注意点
[best practice] learn how eolinker helps Telecommuting