Using Traps
Learn how to create traps and use traps to alter the behavior during calls.
We'll cover the following
Creating a trap to spy
The dummy proxy we created in the previous lesson has no traps in its handler. For each method that’s available on Reflect
, we can optionally create a trap in the handler. To create a trap to be used when reading an object’s property, add a get()
function to the handler.
Arguments in track function
Get hands-on with 1400+ tech skills courses.