Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2016年9月.
handler.get() は、オブジェクトの [[Get]] 内部メソッドに対するトラップです。プロパティアクセサーなどの操作で使用されます。
次の引数が get() メソッドに渡されます。 this はハンドラーにバインドされます。
targetターゲットオブジェクトです。
propertyプロパティの名称を表す文字列または Symbol です。
receiverthis 値はゲッター用です。 Reflect.get() を参照してください。これは通常、プロキシー自身か、プロキシーを継承するオブジェクトです。
get() メソッドはどんな値でも返すことができます。
このトラップは下記の操作に介入できます。
他にも、[[Get]] 内部メソッドを呼び出すあらゆる操作に介入できます。
プロキシーの内部メソッド [[Get]] は、ハンドラー定義が以下の不変条件のいずれかに違反している場合、 TypeError が発生します。
次のコードではプロパティ値の取得をトラップします。
次のコードでは不変条件に違反します。
| ECMAScript® 2027 Language Specification # sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年8月30日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.