프로젝트
GitHub에서 보기
justjavac/proxy-www
justjavac/proxy-www has 870 GitHub stars and 28 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 08:28 UTC. Last push 2021-05-01.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
学会 Proxy 就可以为所欲为吗?对,学会 Proxy 就可以为所欲为!
개발 도구README.md
Originalproxy-www
学会 Proxy 就可以为所欲为吗?
对,学会 Proxy 就可以为所欲为!
原始来源:https://twitter.com/RReverser/status/1138788910975397888 #14
const www = new Proxy(new URL('https://www'), {
get: function get(target, prop) {
let o = Reflect.get(target, prop);
if (typeof o === 'function') {
return o.bind(target)
}
if (typeof prop !== 'string') {
return o;
}
if (prop === 'then') {
return Promise.prototype.then.bind(fetch(target));
}
target = new URL(target);
target.hostname += `.${prop}`;
return new Proxy(target, { get });
}
});
访问百度
www.baidu.com.then(response => {
console.log(response.status);
// ==> 200
})
使用 async/await 语法:
const response = await www.baidu.com
console.log(response.ok)
// ==> true
console.log(response.status);
// ==> 200