Examples for my JS Roundabout talk talk about the Proxy API.
The intro
directory contains examples of these traps:
get
set
deleteProperty
construct
apply
You can run any of the below with node <directory name>
:
debugSetInterval
- loggingsetInterval
registration and clearingfancyConsole
- a Console API-compliant proxy that augments the globalconsole
object with dates and coloured outputlazyRequire
- lazy loading of CommonJS dependenciesmemoisation
- caching the output of a function based upon its inputpreventXss
- preventing malicious JavaScript from being stored in a database and subsequently evaluated a HTML pageschemaValidation
- validate object properties based upon a simple schema
There is a single dependency for the preventXss
example, so be sure to run npm i
first.