Open5

ある Web API が使われているか調べたい

odanodan

JS 実行時の new IntersectionObserver を検知できるかな?

Proxy でできる?

odanodan
handler3 = {
  get(target, prop, receiver) {
    console.log("called", " target: ", target, ", prop: ", prop, ", receiver: ",receiver);
    return target[prop];
  },
};
IntersectionObserver2 = new Proxy(IntersectionObserver, handler3)
new IntersectionObserver2(() => {})

を実行すると

called  target:  ƒ IntersectionObserver() { [native code] } , prop:  prototype , receiver:  

になるので取れてそう

odanodan

自前 polyfill されていればアプリケーションは壊れないので問題はないけど、検知したい
検知した上でちゃんと polyfill されているかも確認したほうが安心ができる