Newer Version Available
How LockerService Uses the Proxy Object
You can interact with a Proxy object in the same way as you interact with the raw JavaScript object, but the object shows up in the browser’s console as a Proxy. It’s useful to understand LockerService’s usage of Proxy if you drop into your browser’s debugger and start poking around.
When a component creates an intrinsic JavaScript object, LockerService returns the raw JavaScript object. When LockerService filters the object, it returns a Proxy object. Some scenarios where LockerService filters an object and returns a Proxy object are:
- Passing an object to a component in a different namespace.
- Passing an object from a component on API version less than 40.0 to the method of a component on API version greater than or equal to 40.0.
- Calling cmp.get() to retrieve an attribute value that you set with the value of a native JavaScript object or array. The object or array isn’t filtered when it’s originally created.
When you access these objects, LockerService returns a Proxy object.
- Any object that implements the HTMLCollection interface
- A SecureElement object, which represents an HTML element.
For more information about standard JavaScript Proxy object, see the Mozilla Developer Network.